CppCMS
Classes | Namespaces | Defines | Enumerations | Functions
booster/log.h File Reference
#include <booster/config.h>
#include <iosfwd>
#include <memory>
#include <string>
#include <booster/copy_ptr.h>
#include <booster/hold_ptr.h>
#include <booster/noncopyable.h>

Go to the source code of this file.

Classes

class  booster::log::message
 This class represents a single message that should be written to log. More...
class  booster::log::sink
 This is the abstract interface to general sink - the consumer of the logged messages. More...
class  booster::log::logger
 This is the central class that manages all logging operations. More...
struct  booster::log::logger::entry
class  booster::log::sinks::standard_error
 stderr based sink - sends messages to standard error output More...
class  booster::log::sinks::file
 log file based sink - sends messages to log file More...

Namespaces

namespace  booster
 

Booster library namespace. The library that implements Boost Like API in ABI backward compatible way.


namespace  booster::log
 

This namespace includes Booster.Log related classes.


namespace  booster::log::sinks
 

This namespace includes various output devices (sinks) for logger.


Defines

#define BOOSTER_LOG(level, module)
 Log a message with severity level of the module to the log device if applicable.
#define BOOSTER_EMERG(m)   BOOSTER_LOG(emergency,m)
 Same as BOOSTER_LOG(emergency,m)
#define BOOSTER_ALERT(m)   BOOSTER_LOG(alert,m)
 Same as BOOSTER_LOG(alert,m)
#define BOOSTER_CRITICAL(m)   BOOSTER_LOG(critical,m)
 Same as BOOSTER_LOG(critical,m)
#define BOOSTER_ERROR(m)   BOOSTER_LOG(error,m)
 Same as BOOSTER_LOG(error,m)
#define BOOSTER_WARNING(m)   BOOSTER_LOG(warning,m)
 Same as BOOSTER_LOG(warning,m)
#define BOOSTER_NOTICE(m)   BOOSTER_LOG(notice,m)
 Same as BOOSTER_LOG(notice,m)
#define BOOSTER_INFO(m)   BOOSTER_LOG(info,m)
 Same as BOOSTER_LOG(info,m)
#define BOOSTER_DEBUG(m)   BOOSTER_LOG(debug,m)
 Same as BOOSTER_LOG(debug,m)

Enumerations

enum  booster::log::level_type {
  emergency = 0, alert = 10, critical = 20, error = 30,
  warning = 40, notice = 50, info = 60, debug = 70,
  all = 100
}

Functions

BOOSTER_API std::string booster::log::sinks::format_plain_text_message (message const &msg)
BOOSTER_API std::string booster::log::sinks::format_plain_text_message_tz (message const &msg, int timezone_offset=0)

Detailed Description


Define Documentation

#define BOOSTER_LOG (   level,
  module 
)
Value:
::booster::log::logger::instance().should_be_logged(::booster::log::level,module)       \
                && ::booster::log::message(::booster::log::level,module,__FILE__,__LINE__).out()

Log a message with severity level of the module to the log device if applicable.

Notes:

  • it first checks of the message should be logged at all, and if not, all the rest is not called
  • the message is logged in the destruction of the output stream object
  • the parameter level should be given as is "warning" or "debug" the namespace flags would be added withing macro
  • It may be more convenient to use BOOSTER_WARNING or BOOSTER_DEBUG macros

Example:

   BOOSTER_LOG(warning,"file_system") << "Failed to open file name " << name;
   BOOSTER_CRITICAL("core") << "Failed to allocate memory";