#include <logger.h>
typedef for a bitmask (long long)
typedef for a component name (std:string)
Use the same values for log levels as syslog
Enumerator |
---|
Lvl0 |
|
Lvl1 |
|
Lvl2 |
|
Lvl3 |
|
Lvl4 |
|
Lvl5 |
|
Logger::Logger |
( |
Logger const & |
| ) |
|
|
private |
static Logger* Logger::get |
( |
| ) |
|
|
inlinestatic |
- Returns
- the singleton instance
short Logger::getLevel |
( |
| ) |
const |
|
inline |
- Returns
- the current debug level
- Parameters
-
- Returns
- respectiv bitmask assigned to given component
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
- Parameters
-
s | : the string that will contain the printable stacktrace |
- Returns
- the number of stacktraces
bool Logger::isLogged |
( |
bitmask |
m | ) |
const |
|
inline |
- Returns
- true if the given component is being logged, false otherwise
void Logger::log |
( |
Level |
lvl, |
|
|
std::string const & |
msg |
|
) |
| const |
Logs the message
- Parameters
-
lvl | : log level of the message |
component | : bitmask assignet to the given component |
msg | : the message to be logged |
- Parameters
-
if | true all unregistered components will be logged, if false only registered components will be logged |
void Logger::registerComponent |
( |
component const & |
comp | ) |
|
- Parameters
-
comp | : the component that will be registered for logging |
void Logger::registerComponents |
( |
std::vector< component > const & |
components | ) |
|
- Parameters
-
components | : list of components that will be registered for logging |
static void Logger::set |
( |
Logger * |
inst | ) |
|
|
inlinestatic |
void Logger::setLevel |
( |
Level |
lvl | ) |
|
|
inline |
- Parameters
-
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
- Parameters
-
comp | : the component name |
tobelogged | : true if we want to log this component |
component name to bitmask mapping
global bitmask with all registered components
number of components that were assigned with a bitmask
char* Logger::unregisteredname |
|
static |
The documentation for this class was generated from the following file: