ui-utilcpp 1.10.4
|
Syslog Macro Log: Simple logging based on compiler macros and syslog(3) for mono-threaded aplications. More...
Macros | |
#define | SM_LOGLEVEL LOG_NOTICE |
The Log Level; Log code under this level gets eliminated. | |
#define | SM_LOGADD __FILE__ << ":" << __LINE__ |
Add this text to every log messages. | |
#define | SM_LOG(l, p, x) |
Master Macro (must not be used directly). | |
#define | SM_LOGEMERG(x) |
Macro for syslog(3) level EMERG. | |
#define | SM_LOGALERT(x) |
Macro for syslog(3) level ALERT. | |
#define | SM_LOGCRIT(x) |
Macro for syslog(3) level CRIT. | |
#define | SM_LOGERR(x) |
Macro for syslog(3) level ERR. | |
#define | SM_LOGWARNING(x) |
Macro for syslog(3) level WARNING. | |
#define | SM_LOGNOTICE(x) |
Macro for syslog(3) level NOTICE. | |
#define | SM_LOGINFO(x) |
Macro for syslog(3) level INFO. | |
#define | SM_LOGDEBUG(x) |
Macro for syslog(3) level DEBUG. | |
Additional debug levels 8-11. | |
#define | SM_LOGDEBUG1(x) |
#define | SM_LOGDEBUG2(x) |
#define | SM_LOGDEBUG3(x) |
#define | SM_LOGDEBUG4(x) |
Syslog Macro Log: Simple logging based on compiler macros and syslog(3) for mono-threaded aplications.
Synopsis:
This can be used as drop-in replacement for SMLog.hpp, i.e. the source using these logging macros does not need to be changed.
Each prirority level (see syslog(3)) gets its own compiler macro, which can be used rather straightforward in the source; the argument of the macro may include stream piping. For example:
SM_LOGNOTICE("I have noticed something: " << something)
Logs can be turned off at compile time (giving full run time advantage, as the code is removed) with a threshold. Additionally, you can give the facility, and additional text at compile time. For example:
c++ ... -DSM_LOGLEVEL=5 -DSM_LOGADD="getpid()" -DSM_LOGFACILITY="ost::SLOG_USER"
eliminates all log messages with priority higher than 5, giving the process id as additional information
Logging itself is done via SysLogMonoSingleton; it should be configured somewhere at the beginning of your program, for example like:
#define SM_LOG | ( | l, | |
p, | |||
x ) |
Master Macro (must not be used directly).
#define SM_LOGALERT | ( | x | ) |
#define SM_LOGCRIT | ( | x | ) |
Macro for syslog(3) level CRIT.
#define SM_LOGDEBUG | ( | x | ) |
Macro for syslog(3) level DEBUG.
#define SM_LOGEMERG | ( | x | ) |
Macro for syslog(3) level EMERG.
#define SM_LOGERR | ( | x | ) |
Macro for syslog(3) level ERR.
#define SM_LOGINFO | ( | x | ) |
Macro for syslog(3) level INFO.
#define SM_LOGNOTICE | ( | x | ) |
Macro for syslog(3) level NOTICE.
#define SM_LOGWARNING | ( | x | ) |
Macro for syslog(3) level WARNING.