31 #include <boost/date_time/posix_time/posix_time.hpp> 32 #include <boost/foreach.hpp> 33 #include <boost/iostreams/concepts.hpp> 34 #include <boost/iostreams/stream.hpp> 35 #include <boost/lexical_cast.hpp> 36 #include <boost/program_options.hpp> 37 #include <boost/shared_ptr.hpp> 39 namespace po = boost::program_options;
44 #define __PRETTY_FUNCTION__ ( std::string("At ") + basename(__FILE__) + \ 45 std::string(" line ") + boost::lexical_cast<std::string>(__LINE__) ).c_str() 52 std::string
basename(
const std::string s );
75 void SetOutputLevel(
const std::string logger,
const unsigned int level);
88 typedef std::map< const std::string, unsigned int >
OutputMap;
94 class CLog :
public boost::iostreams::sink
104 CLog(
const CLoggerPointer p,
const unsigned int level_,
105 const std::string name_, std::ostream*
const out_= &std::clog );
107 std::streamsize write(
const char*
const s, std::streamsize n);
136 boost::iostreams::stream<CLog>
Trace;
138 boost::iostreams::stream<CLog>
Debug;
140 boost::iostreams::stream<CLog>
Info;
146 boost::iostreams::stream<CLog>
Warn;
148 boost::iostreams::stream<CLog>
Error;
150 boost::iostreams::stream<CLog>
Alert;
152 boost::iostreams::stream<CLog>
Fatal;
154 std::string GetName()
const;
boost::iostreams::stream< CLog > Info
Logger.
Definition: CLogger.hpp:140
const CLoggerPointer m_parent
The local logger managing this logger.
Definition: CLogger.hpp:112
const std::string m_name
String name of this logger.
Definition: CLogger.hpp:116
unsigned int GetOutputLevel(const std::string logger) const
Fetch the logging level of a specific logger.
Definition: CLogger.cpp:241
void RegisterLocalLogger(const std::string logger)
Register a local logger with the global logger.
Definition: CLogger.cpp:196
void SetInitialLoggerLevels(const std::string loggerCfgFile)
Reads the logging levels of all loggers from the config file.
Definition: CLogger.cpp:262
void SetOutputLevel(const std::string logger, const unsigned int level)
Sets the logging level of a specific logger.
Definition: CLogger.cpp:227
static CGlobalLogger & instance()
Retrieves the singleton instance of the global logger.
Definition: CLogger.cpp:183
boost::iostreams::stream< CLog > Debug
Logger.
Definition: CLogger.hpp:138
boost::iostreams::stream< CLog > Alert
Logger.
Definition: CLogger.hpp:150
std::string basename(const std::string s)
Turns a qualified path into just a filename.
Definition: CLogger.cpp:57
void ListLoggers() const
Lists all the avaible loggers and their current levels.
Definition: CLogger.cpp:320
boost::iostreams::stream< CLog > Status
Logger.
Definition: CLogger.hpp:144
Tracks the global logging configuration.
Definition: CLogger.hpp:60
std::ostream *const m_ostream
Output stream to use.
Definition: CLogger.hpp:118
void SetGlobalLevel(const unsigned int level)
Sets the logging level of all loggers.
Definition: CLogger.cpp:208
boost::iostreams::stream< CLog > Notice
Logger.
Definition: CLogger.hpp:142
Definition: CLogger.hpp:121
CLocalLogger * CLoggerPointer
Boost requires this to be a raw pointer.
Definition: CLogger.hpp:54
std::map< const std::string, unsigned int > OutputMap
Type of container for the output levels.
Definition: CLogger.hpp:88
const std::string m_name
The name of this logger.
Definition: CLogger.hpp:162
OutputMap m_loggers
The map of loggers to logger levels.
Definition: CLogger.hpp:90
unsigned int m_default
What the output level is if not set specifically.
Definition: CLogger.hpp:86
boost::iostreams::stream< CLog > Error
Logger.
Definition: CLogger.hpp:148
General FREEDM Namespace.
Definition: CBroker.cpp:53
boost::iostreams::stream< CLog > Trace
Logger.
Definition: CLogger.hpp:136
Logging Output Software.
Definition: CLogger.hpp:94
boost::iostreams::stream< CLog > Fatal
Logger.
Definition: CLogger.hpp:152
boost::iostreams::stream< CLog > Warn
Logger.
Definition: CLogger.hpp:146
unsigned int m_level
The level of this logger.
Definition: CLogger.hpp:114