|
Fluid Dynamics Library
|
#include <logger.h>
Public Types | |
| enum | LEVEL { ERROR = 1, WARN = 2, INFO = 4, DEBUG = 8, DEV = 16 } |
Public Member Functions | |
| Logger () | |
| ~Logger () | |
| std::ostringstream & | log (Logger::LEVEL level) |
| std::ostringstream & | log (Logger::LEVEL level, const std::string &identity) |
Static Public Member Functions | |
| static bool | canLog (Logger::LEVEL level) |
| static const int | setLevel (const int level) |
| static const int | getLevel () |
| static void | pushLevel (Logger::LEVEL level) |
| static void | popLevel () |
| static void | setIdentity (const std::string &identity) |
| static const std::string | getIdentity () |
| static void | registerWriter (LogWriter *writer) |
| static void | unRegisterWriter (LogWriter *writer) |
| static std::string | currentTime (const char *format="%d-%b-%Y %H:%M:%S") |
| static std::string | loggerLevelAsString (Logger::LEVEL level) |
| static Logger::LEVEL | stringAsLoggerLevel (std::string level_string) |
| static int | levelAndBelow (Logger::LEVEL level) |
Static Public Attributes | |
| static const int | LEVEL_FLOOR = Logger::ERROR |
| static const int | ALL = 255 |
| static const int | DEFAULT_REPORTING_LEVEL = 31 |
Protected Member Functions | |
| void | writeMessage () |
Protected Attributes | |
| std::string * | m_local_identity |
| std::ostringstream | m_message |
| Logger::LEVEL | m_messageLevel |
Static Protected Attributes | |
| static int | _level = Logger::DEFAULT_REPORTING_LEVEL |
| static std::vector< int > | _levelStack |
| static const int | _maxWriters = 10 |
| static std::list< LogWriter * > | _registeredWriters |
| static std::string | _identity = "fdlLogger" |
Logger is a class designed for making simple, robust, cross platform logging that is thread-safe and can be used for stdout or a log file.
| fdl::Logger::Logger | ( | ) |
Constructor.
Definition at line 31 of file logger.cpp.
| fdl::Logger::~Logger | ( | ) |
Destructor.
Definition at line 39 of file logger.cpp.
| bool fdl::Logger::canLog | ( | Logger::LEVEL | compare | ) | [static] |
Determines whether or not the level is currently being logged.
| compare | logger level to check |
Definition at line 171 of file logger.cpp.
| std::string fdl::Logger::currentTime | ( | const char * | format = "%d-%b-%Y %H:%M:%S" | ) | [static] |
Returns the current time using the Boost dateTime library given an input format.
| format | the dateTime format for the time |
Definition at line 239 of file logger.cpp.
| const std::string fdl::Logger::getIdentity | ( | ) | [static] |
Returns the identity value of the logger
Definition at line 62 of file logger.cpp.
| const int fdl::Logger::getLevel | ( | ) | [static] |
| int fdl::Logger::levelAndBelow | ( | Logger::LEVEL | level | ) | [static] |
Computes a logger level bit mask that will cover the parameter level and everything more important
| level | a logger level mask |
Definition at line 333 of file logger.cpp.
| std::ostringstream & fdl::Logger::log | ( | Logger::LEVEL | level, |
| const std::string & | identity | ||
| ) |
Assigns the local identity of a given message and stores it to be logged at the next write step.
| level | a logger level |
| identity | for the message |
Definition at line 204 of file logger.cpp.
| std::ostringstream & fdl::Logger::log | ( | Logger::LEVEL | level | ) |
Stores the input message to be logged at the next write step.
| level | a logger level mask |
Definition at line 190 of file logger.cpp.
| std::string fdl::Logger::loggerLevelAsString | ( | Logger::LEVEL | level | ) | [static] |
Returns a string representation of the logger level
| level | the logging level |
Definition at line 258 of file logger.cpp.
| void fdl::Logger::popLevel | ( | ) | [static] |
Removes the last logger level on the stack.
Definition at line 154 of file logger.cpp.
| void fdl::Logger::pushLevel | ( | Logger::LEVEL | level | ) | [static] |
Adds a level to the logger level stack.
| level | to be added |
Definition at line 141 of file logger.cpp.
| void fdl::Logger::registerWriter | ( | LogWriter * | writer | ) | [static] |
Registers a logwriter, thus adding it to the logging process
| writer | to be registered |
Definition at line 111 of file logger.cpp.
| void fdl::Logger::setIdentity | ( | const std::string & | identity | ) | [static] |
Sets the new identity of the logger
| identity | new string value for the logger |
Definition at line 52 of file logger.cpp.
| const int fdl::Logger::setLevel | ( | const int | level | ) | [static] |
Sets the level of the logger
| level | the new logger level |
Definition at line 74 of file logger.cpp.
| Logger::LEVEL fdl::Logger::stringAsLoggerLevel | ( | std::string | level_string | ) | [static] |
Returns a logger level given a string representation of an existing level
| a | string for the level |
Definition at line 297 of file logger.cpp.
| void fdl::Logger::unRegisterWriter | ( | LogWriter * | writer | ) | [static] |
Unregisters a logwriter, thus removing it from the logging process
| writer | to be unregistered |
Definition at line 129 of file logger.cpp.
| void fdl::Logger::writeMessage | ( | ) | [protected] |
Iterates through the logwriter stack and calls write() on each of them.
Definition at line 217 of file logger.cpp.
1.7.4