#include <logger.h>
Collaboration diagram for Logger:
Public Types | |
| typedef unsigned long long | bitmask |
| typedef for a bitmask (long long) | |
| typedef std::string | component |
| typedef for a component name (std:string) | |
| Lvl0 | |
| Lvl1 | |
| Lvl2 | |
| Lvl3 | |
| Lvl4 | |
| enum | Level { Lvl0, Lvl1, Lvl2, Lvl3, Lvl4 } |
Public Member Functions | |
| ~Logger () | |
| Destructor. | |
| short | getLevel () const |
| void | setLevel (Level lvl) |
| bool | isLogged (bitmask m) const |
| void | registerComponent (component const &comp) |
| void | registerComponents (std::vector< component > const &components) |
| void | setLogged (component const &comp, bool tobelogged) |
| void | log (Level lvl, std::string const &msg) const |
| void | logAll () |
| bitmask | getMask (component const &comp) |
Static Public Member Functions | |
| static Logger * | get () |
| static void | set (Logger *inst) |
| static int | getStackTrace (std::string &s) |
Static Public Attributes | |
| static bitmask | unregistered |
| static char * | unregisteredname |
| static Logger * | instance |
Private Member Functions | |
| Logger () | |
| Private constructor. | |
| Logger (Logger const &) | |
| Logger & | operator= (Logger const &) |
Private Attributes | |
| short | level |
| current log level | |
| int | size |
| number of components that were assigned with a bitmask | |
| bitmask | mask |
| global bitmask with all registered components | |
| std::map< component, bitmask > | mapping |
| component name to bitmask mapping | |
| typedef unsigned long long Logger::bitmask |
typedef for a bitmask (long long)
| typedef std::string Logger::component |
typedef for a component name (std:string)
| enum Logger::Level |
| Logger::~Logger | ( | ) |
Destructor.
| Logger::Logger | ( | ) | [private] |
Private constructor.
| Logger::Logger | ( | Logger const & | ) | [private] |
| static Logger* Logger::get | ( | ) | [inline, static] |
| short Logger::getLevel | ( | ) | const [inline] |
| comp | : component name |
| static int Logger::getStackTrace | ( | std::string & | s | ) | [static] |
Build a printable stacktrace. Useful e.g. inside exceptions, to understand where they come from. Note: I don't think that the backtrace() function is thread safe, nor this function Returns the number of backtraces
| s | : the string that will contain the printable stacktrace |
| bool Logger::isLogged | ( | bitmask | m | ) | const [inline] |
| void Logger::log | ( | Level | lvl, | |
| std::string const & | msg | |||
| ) | const |
Logs the message
| lvl | : log level of the message | |
| component | : bitmask assignet to the given component | |
| msg | : the message to be logged |
| void Logger::logAll | ( | ) | [inline] |
| if | true all unregistered components will be logged, if false only registered components will be logged |
| void Logger::registerComponent | ( | component const & | comp | ) |
| comp | : the component that will be registered for logging |
| void Logger::registerComponents | ( | std::vector< component > const & | components | ) |
| components | : list of components that will be registered for logging |
| static void Logger::set | ( | Logger * | inst | ) | [inline, static] |
| void Logger::setLevel | ( | Level | lvl | ) | [inline] |
| lvl | : the logging level that will be set |
| void Logger::setLogged | ( | component const & | comp, | |
| bool | tobelogged | |||
| ) |
Sets if a component has to be logged or not
| comp | : the component name | |
| tobelogged | : true if we want to log this component |
Logger* Logger::instance [static] |
short Logger::level [private] |
current log level
std::map<component, bitmask> Logger::mapping [private] |
component name to bitmask mapping
bitmask Logger::mask [private] |
global bitmask with all registered components
int Logger::size [private] |
number of components that were assigned with a bitmask
bitmask Logger::unregistered [static] |
char* Logger::unregisteredname [static] |
1.4.7