1 #ifndef NETCACHE__SRV_DIAG__HPP
2 #define NETCACHE__SRV_DIAG__HPP
44 #define _VERIFY(x) if (x) {} else SRV_FATAL("assertion failed: " << #x)
50 # define _ASSERT(x) _VERIFY(x)
52 # define _ASSERT(x) do {} while (0)
58 #define assert(x) _ASSERT(x)
98 const char* func)
const;
162 #define SRV_LOG(sev, msg) \
164 if (CSrvDiagMsg::IsSeverityVisible(CSrvDiagMsg::sev)) { \
165 CSrvDiagMsg().StartSrvLog(CSrvDiagMsg::sev, \
166 __FILE__, __LINE__, \
167 NCBI_CURRENT_FUNCTION) \
173 #define SRV_FATAL(msg) \
175 SRV_LOG(Fatal, "Fatal error: " << msg); \
182 #define INFO(msg) CSrvDiagMsg().StartInfo() << msg
Class used in all diagnostic logging.
const CSrvDiagMsg & StartSrvLog(ESeverity sev, const char *file, int line, const char *func) const
Starts log message which will include severity, filename, line number and function name.
CSrvDiagMsg & PrintExtra(void)
Starts "extra" message.
const CSrvDiagMsg & operator<<(CTempString str) const
Converts input value to string and adds to started log message.
CSrvDiagMsg & StartRequest(void)
Starts "request-start" message.
CSrvDiagMsg & PrintParam(CTempString name, CTempString value)
Adds parameter to "request-start" or "extra" message.
SLogData * m_Data
Log data from current thread.
SSrvThread * m_Thr
Current thread created this object.
bool m_OldStyle
Flag showing if "old style" message was started.
const CSrvDiagMsg & StartInfo(void) const
Starts informational message which doesn't need to have filename, line number or function name.
void StopRequest(void)
Prints "request-stop" message.
void Flush(void)
Finishes current message and prepare to start new one.
static bool IsSeverityVisible(ESeverity sev)
Checks if given severity level is visible, i.e.
const CSrvDiagMsg & StartOldStyle(const char *file, int line, const char *func)
Starts the "old style" log message.
ESeverity
Severity levels for logging.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
static const char * str(char *buf, int n)
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const GenericPointer< typename T::ValueType > T2 value