bref
API 2014 of the Zia HTTP server.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Classes | Defines
/Users/giersc_v/projets/zia/api/include/bref/ScopedLogger.h File Reference

ScopedLogger class and associated macros definitions. More...

#include <sstream>
#include "ILogger.h"
#include "detail/util/NonCopyable.hpp"

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.

Detailed Description

ScopedLogger class and associated macros definitions.

Author:
Guillaume Papin guill.nosp@m.aume.nosp@m..papi.nosp@m.n@ep.nosp@m.itech.nosp@m..eu
Date:
Sat Mar 10 21:29:54 2012

Define Documentation

#define LOG (   logger,
  sev 
)
Value:
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;
See also:
LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_FATAL
#define LOG_DEBUG (   logger)    LOG(logger, bref::ILogger::Debug)

Get the debug stream.

See also:
bref::ILogger::Debug
#define LOG_ERROR (   logger)    LOG(logger, bref::ILogger::Error)

Get the stream to log an error.

See also:
bref::ILogger::Error
#define LOG_FATAL (   logger)    LOG(logger, bref::ILogger::Fatal)

Get the stream to log a fatal message.

See also:
bref::ILogger::Fatal
#define LOG_INFO (   logger)    LOG(logger, bref::ILogger::Info)

Get the stream to log an information.

See also:
bref::ILogger::Info
#define LOG_WARN (   logger)    LOG(logger, bref::ILogger::Warning)

Get the stream to log a warning.

See also:
bref::ILogger::Warning