NCBI C++ ToolKit
|
Search Toolkit Book for SDiagMessage
#include <corelib/ncbidiag.hpp>
Public Types | |
enum | EEventType { eEvent_Start , eEvent_Stop , eEvent_Extra , eEvent_RequestStart , eEvent_RequestStop , eEvent_PerfLog } |
Type of event to report. More... | |
enum | EDiagWriteFlags { fNone = 0x0 , fNoEndl = 0x01 , fNoPrefix = 0x02 } |
Compose a message string in the standard format(see also "flags"): "<file>", line <line>: <severity>: [<prefix>] <message> [EOL] and put it to string "str", or write to an output stream "os". More... | |
typedef Uint8 | TPID |
Process ID. More... | |
typedef Uint8 | TTID |
Thread ID. More... | |
typedef Int8 | TUID |
Unique process ID. More... | |
typedef Uint8 | TCount |
Generic type for counters (posts, requests etc.) More... | |
typedef pair< string, string > | TExtraArg |
typedef list< TExtraArg > | TExtraArgs |
typedef int | TDiagWriteFlags |
Public Member Functions | |
SDiagMessage (EDiagSev severity, const char *buf, size_t len, const char *file=0, size_t line=0, TDiagPostFlags flags=eDPF_Default, const char *prefix=0, int err_code=0, int err_subcode=0, const char *err_text=0, const char *module=0, const char *nclass=0, const char *function=0) | |
Initialize SDiagMessage fields. More... | |
SDiagMessage (const SDiagMessage &message) | |
Copy constructor required to store the messages and flush them when the diagnostics setup is finished. More... | |
SDiagMessage & | operator= (const SDiagMessage &message) |
Assignment of messages. More... | |
SDiagMessage (const string &message, bool *result=0) | |
Parse a string back into SDiagMessage. More... | |
~SDiagMessage (void) | |
bool | ParseMessage (const string &message) |
Parse the whole string into the message. More... | |
string | FormatExtraMessage (void) const |
Convert extra arguments to string. More... | |
TUID | GetUID (void) const |
Get UID from current context or parsed from a string. More... | |
CTime | GetTime (void) const |
Get time and date - current or parsed. More... | |
void | Write (string &str, TDiagWriteFlags flags=fNone) const |
Binary OR of "EDiagWriteFlags". More... | |
CNcbiOstream & | Write (CNcbiOstream &os, TDiagWriteFlags fl=fNone) const |
Write to stream. More... | |
const string & | GetHost (void) const |
Access to strings stored in SDiagMessageData. More... | |
string | GetClient (void) const |
string | GetSession (void) const |
const string & | GetAppName (void) const |
EDiagAppState | GetAppState (void) const |
CNcbiOstream & | x_OldWrite (CNcbiOstream &os, TDiagWriteFlags fl=fNone) const |
CNcbiOstream & | x_NewWrite (CNcbiOstream &os, TDiagWriteFlags fl=fNone) const |
string | x_GetModule (void) const |
Static Public Member Functions | |
static void | ParseDiagStream (CNcbiIstream &in, INextDiagMessage &func) |
Stream parser. More... | |
static string | GetEventName (EEventType event) |
static void | s_EscapeNewlines (string &buf) |
static void | s_UnescapeNewlines (string &buf) |
Public Attributes | |
EDiagSev | m_Severity |
Severity level. More... | |
const char * | m_Buffer |
Not guaranteed to be '\0'-terminated! More... | |
size_t | m_BufferLen |
Length of m_Buffer. More... | |
const char * | m_File |
File name. More... | |
const char * | m_Module |
Module name. More... | |
const char * | m_Class |
Class name. More... | |
const char * | m_Function |
Function name. More... | |
size_t | m_Line |
Line number in file. More... | |
int | m_ErrCode |
Error code. More... | |
int | m_ErrSubCode |
Sub Error code. More... | |
TDiagPostFlags | m_Flags |
Bitwise OR of "EDiagPostFlag". More... | |
const char * | m_Prefix |
Prefix string. More... | |
const char * | m_ErrText |
Sometimes 'error' has no numeric code, but can be represented as text. More... | |
TPID | m_PID |
Process ID. More... | |
TTID | m_TID |
Thread ID. More... | |
TCount | m_ProcPost |
Number of the post in the process. More... | |
TCount | m_ThrPost |
Number of the post in the thread. More... | |
TCount | m_RequestId |
FastCGI iteration or request ID. More... | |
EEventType | m_Event |
If the severity is eDPF_AppLog, m_Event contains event type. More... | |
TExtraArgs | m_ExtraArgs |
If event type is "extra", contains the list of arguments. More... | |
bool | m_TypedExtra |
Set to true if this is a typed extra message (the arguments include "NCBIEXTRATYPE=<extra-type>"). More... | |
bool | m_NoTee |
Special flag indicating that the message should not be printed by Tee-handler. More... | |
bool | m_PrintStackTrace |
Private Types | |
enum | EFormatFlag { eFormat_Old , eFormat_New , eFormat_Auto } |
Private Member Functions | |
bool | x_ParseExtraArgs (const string &str, size_t pos) |
void | x_SetFormat (EFormatFlag fmt) const |
bool | x_IsSetOldFormat (void) const |
void | x_InitData (void) const |
void | x_SaveContextData (void) const |
Private Attributes | |
SDiagMessageData * | m_Data |
EFormatFlag | m_Format |
bool | m_AllowBadExtraNames |
Friends | |
class | CDiagContext |
class | CDiagContext_Extra |
SDiagMessage –.
Diagnostic message structure.
Defines structure of the "data" message that is used with message handler function("func"), and destructor("cleanup"). The "func(..., data)" to be called when any instance of "CNcbiDiagBuffer" has a new diagnostic message completed and ready to post. "cleanup(data)" will be called whenever this hook gets replaced and on the program termination. NOTE 1: "func()", "cleanup()" and "g_SetDiagHandler()" calls are MT-protected, so that they would never be called simultaneously from different threads. NOTE 2: By default, the errors will be written to standard error stream.
Definition at line 1599 of file ncbidiag.hpp.