NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
SDiagMessage Struct Reference

Search Toolkit Book for SDiagMessage

SDiagMessage –. More...

#include <corelib/ncbidiag.hpp>

+ Collaboration diagram for SDiagMessage:

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, stringTExtraArg
 
typedef list< TExtraArgTExtraArgs
 
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...
 
SDiagMessageoperator= (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...
 
CNcbiOstreamWrite (CNcbiOstream &os, TDiagWriteFlags fl=fNone) const
 Write to stream. More...
 
const stringGetHost (void) const
 Access to strings stored in SDiagMessageData. More...
 
string GetClient (void) const
 
string GetSession (void) const
 
const stringGetAppName (void) const
 
EDiagAppState GetAppState (void) const
 
CNcbiOstreamx_OldWrite (CNcbiOstream &os, TDiagWriteFlags fl=fNone) const
 
CNcbiOstreamx_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

SDiagMessageDatam_Data
 
EFormatFlag m_Format
 
bool m_AllowBadExtraNames
 

Friends

class CDiagContext
 
class CDiagContext_Extra
 

Detailed Description

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.


The documentation for this struct was generated from the following files:
Modified on Sun May 05 05:23:13 2024 by modify_doxy.py rev. 669887