*
months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"};
103thread_local unique_ptr<FtaMsgPost>
bmp;
109 if(strsevcode.empty())
120 if(
autoit = sStringToInt.
find(strsevcode);
121it != sStringToInt.
end()) {
130 const char* module,
int code,
intsubcode,
string& strcode,
string& strsubcode,
ErrSev& sevcode)
142 for(
const auto& bmmf :
bmp->bmmf_list) {
143 if(bmmf.modname != module) {
148 for(
const auto& bmmt : bmmf.bmmt_list) {
149 if(bmmt.inttag !=
code)
152strcode = bmmt.strtag;
153 for(
const auto& bmctx : bmmt.bmctx_list) {
154 if(bmctx.intsubtag != subcode)
157strsubcode = bmctx.strsubtag;
158sevcode = bmctx.intseverity;
171FILE* fd = fopen(
buf.c_str(),
"r");
174fd = fopen(
buf.c_str(),
"r");
180 auto& bmmf =
bmp->bmmf_list.emplace_front();
181bmmf.modname = module;
182bmmf.filename =
buf;
184 while(fgets(s, 2047, fd)) {
185 if(s[0] !=
'$'|| (s[1] !=
'^'&& s[1] !=
'$'))
192 for(p = s + 2; *p ==
' '|| *p ==
'\t'; p++) {}
193 for(q = p; *p && *p !=
','; p++) {}
200 for(*p++ =
','; *p ==
' '|| *p ==
'\t'; p++) {}
201 for(q = p; *p >=
'0'&& *p <=
'9'; p++) {}
216 if(s[1] ==
'^'&& ch ==
',') {
217 for(p++; *p ==
' '|| *p ==
'\t'; p++) {}
219*p && *p !=
' '&& *p !=
'\t'&& *p !=
'\n'&& *p !=
',';
224 if(!
strcmp(q,
"SEV_INFO") || !
strcmp(q,
"SEV_WARNING") ||
225!
strcmp(q,
"SEV_ERROR") || !
strcmp(q,
"SEV_REJECT") ||
226!
strcmp(q,
"SEV_FATAL")) {
234 auto& bmmt = bmmf.bmmt_list.emplace_front();
237 if(val2 ==
code&& strcode.empty())
243 if(bmmf.bmmt_list.empty()) {
247 auto& bmmt = bmmf.bmmt_list.front();
248 auto& bmctx = bmmt.bmctx_list.emplace_front();
250bmctx.strsubtag = val1;
251bmctx.intsubtag = val2;
254 if(val2 == subcode && strsubcode.empty() && ! strcode.empty()) {
257sevcode = bmctx.intseverity;
275 bmp->hook_only =
false;
295 bmp->prefix_accession = name;
298 bmp->prefix_locus = name;
301 if(name.size() > 20)
302name = name.substr(0, 20);
313 bmp->prefix_accession.clear();
316 bmp->prefix_locus.clear();
319 bmp->prefix_feature.clear();
330 if(! logfile || ! *logfile)
336 if(
bmp->logfile.empty()) {
337 bmp->logfile = logfile;
340 if(!
bmp->lfd && !
bmp->logfile.empty()) {
342tm = localtime(&now);
343 i= tm->tm_hour % 12;
347 bmp->lfd = fopen(
bmp->logfile.c_str(),
"a");
349 "\n========================[ %s %d, %d %2d:%02d %s ]========================\n",
355(tm->tm_hour >= 12) ?
"PM":
"AM");
368 bmp->show_msg_codes =
true;
370 bmp->show_log_codes =
true;
372 bmp->show_msg_codeline =
true;
374 bmp->show_log_codeline =
true;
380 if(!
str||
str[0] ==
'\0')
386fprintf(
bmp->lfd,
"%s",
str);
398 bmp->loglevel = sev;
411 bmp->msglevel = sev;
431 switch(c_severity) {
452 return(cxx_severity);
460 charfpiBuffer[1024];
471 intfpiIntcode = lev1;
472 intfpiIntsubcode = lev2;
475 stringfpiStrsubcode;
478 const char* fpiFname =
fec.
fname;
485 if(fpiModule && *fpiModule)
486 FtaErrGetMsgCodes(fpiModule, fpiIntcode, fpiIntsubcode, fpiStrcode, fpiStrsubcode, fpiSevcode);
488fpiModule =
nullptr;
493 if(
bmp->appname.empty())
496stringstream textStream;
497 if(! fpiStrcode.empty()) {
498textStream <<
"["<< fpiStrcode.c_str();
499 if(! fpiStrsubcode.empty()) {
500textStream <<
"."<< fpiStrsubcode.c_str();
505 if(
bmp->show_log_codeline) {
506textStream <<
"{"<< fpiFname <<
", line "<< fpiLine;
508 if(!
bmp->prefix_locus.empty()) {
509textStream <<
bmp->prefix_locus <<
": ";
511 if(!
bmp->prefix_accession.empty()) {
512textStream <<
bmp->prefix_accession <<
": ";
514 if(!
bmp->prefix_feature.empty()) {
515textStream <<
bmp->prefix_feature <<
" ";
529.
Report(fpiModule ? fpiModule :
"",
530sSeverityMap.at(fpiSevcode),
550 if(
str.size() > 1023)
551 str=
str.substr(0, 1023);
static CFlatFileMessageReporter & GetInstance()
void Report(const string &module, EDiagSev severity, int code, int subcode, const string &text, int lineNum=-1)
const_iterator end() const
const_iterator find(const key_type &key) const
int fta_atoi(string_view sv)
static ErrSev FtaStrSevToIntSev(const string &strsevcode)
bool ErrSetLog(const char *logfile)
void FtaInstallPrefix(int prefix, string_view name, string_view location)
ErrSev ErrSetLogLevel(ErrSev sev)
void FtaDeletePrefix(int prefix)
void Nlm_ErrSetContext(const char *module, const char *fname, int line)
thread_local unique_ptr< FtaMsgPost > bmp
void Nlm_ErrPostStr(ErrSev sev, int lev1, int lev2, string_view str)
void ErrSetOptFlags(int flags)
static void s_ReportError(ErrSev sev, int lev1, int lev2, string_view msg)
ErrSev ErrSetMessageLevel(ErrSev sev)
EDiagSev ErrCToCxxSeverity(int c_severity)
NCBI_UNUSED string ErrFormat(const char *fmt,...)
void ErrLogPrintStr(const char *str)
static void FtaErrGetMsgCodes(const char *module, int code, int subcode, string &strcode, string &strsubcode, ErrSev &sevcode)
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char * str(char *buf, int n)
static const char location[]
static string GetAppName(EAppNameType name_type=eBaseName, int argc=0, const char *const *argv=NULL)
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
static char GetPathSeparator(void)
Get path separator symbol specific for the current platform.
static string GetCwd(void)
Get the current working directory.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
int strcmp(const char *str1, const char *str2)
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
std::forward_list< FtaMsgModTag > bmmt_list
std::forward_list< FtaMsgModTagCtx > bmctx_list
std::forward_list< FtaMsgModFile > bmmf_list
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4