bref
API 2014 of the Zia HTTP server.
|
ScopedLogger class and associated macros definitions. More...
Go to the source code of this file.
Classes | |
class | bref::ScopedLogger |
RAII class for the ILogger interface. More... | |
Defines | |
#define | LOG(logger, sev) |
A macro to get a logging stream of a given severity. | |
#define | LOG_DEBUG(logger) LOG(logger, bref::ILogger::Debug) |
Get the debug stream. | |
#define | LOG_INFO(logger) LOG(logger, bref::ILogger::Info) |
Get the stream to log an information. | |
#define | LOG_WARN(logger) LOG(logger, bref::ILogger::Warning) |
Get the stream to log a warning. | |
#define | LOG_ERROR(logger) LOG(logger, bref::ILogger::Error) |
Get the stream to log an error. | |
#define | LOG_FATAL(logger) LOG(logger, bref::ILogger::Fatal) |
Get the stream to log a fatal message. |
ScopedLogger class and associated macros definitions.
#define LOG | ( | logger, | |
sev | |||
) |
if (sev < logger->severity()) \
{ } \
else \
bref::ScopedLogger(logger, sev).log()
A macro to get a logging stream of a given severity.
This macros check the current level of the logger and the stream is used only in this case. This is useful to limit the cost of the stream operations, by creating the stream only when needed.
Example:
LOG(logger, bref::ILogger::Debug) << "new connection from " << host;
#define LOG_DEBUG | ( | logger | ) | LOG(logger, bref::ILogger::Debug) |
Get the debug stream.
#define LOG_ERROR | ( | logger | ) | LOG(logger, bref::ILogger::Error) |
Get the stream to log an error.
#define LOG_FATAL | ( | logger | ) | LOG(logger, bref::ILogger::Fatal) |
Get the stream to log a fatal message.
#define LOG_INFO | ( | logger | ) | LOG(logger, bref::ILogger::Info) |
Get the stream to log an information.
#define LOG_WARN | ( | logger | ) | LOG(logger, bref::ILogger::Warning) |
Get the stream to log a warning.