CppCMS
Classes | Namespaces | Macros | Enumerations | Functions
log.h File Reference
#include <booster/config.h>
#include <iosfwd>
#include <booster/auto_ptr_inc.h>
#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::shared_ptr< T >
 
class  booster::weak_ptr< T >
 
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...
 
class  booster::log::sinks::standard_error
 stderr based sink - sends messages to standard error output More...
 
class  booster::log::sinks::stream
 log sink for a generic std::ostream More...
 
class  booster::log::sinks::file
 log file based sink - sends messages to log file More...
 

Namespaces

 booster
 Booster library namespace. The library that implements Boost Like API in ABI backward compatible way.
 
 booster::log
 This namespace includes Booster.Log related classes.
 
 booster::log::sinks
 This namespace includes various output devices (sinks) for logger.
 

Macros

#define BOOSTER_LOG(level, module)
 Log a message with severity level of the module to the log device if applicable. More...
 
#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)
 

Macro Definition 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()
static logger & instance()
basic_message< char > message
Definition: message.h:494
bool should_be_logged(level_type level, char const *module)

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:

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