|
libupnpp 0.16.0
A C++ wrapper for the Portable UPnP reference library
|
This is a singleton class. More...
#include <log.h>
Public Types | |
| enum | LogLevel { LLNON =0 , LLFAT =1 , LLERR =2 , LLINF =3 , LLDEB =4 , LLDEB0 =5 , LLDEB1 =6 , LLDEB2 =7 } |
| Log level values. More... | |
Public Member Functions | |
| Logger (const Logger &)=delete | |
| Logger & | operator= (const Logger &)=delete |
| bool | reopen (const std::string &fn) |
| Close and reopen the output file. | |
| std::ostream & | getstream () |
| Retrieve the output stream in case you need to write directly to it. | |
| void | setLogLevel (LogLevel level) |
| Set the log dynamic verbosity level. | |
| void | setloglevel (LogLevel level) |
| Set the log dynamic verbosity level. | |
| int | getloglevel () const |
| Retrieve the current log level. | |
| const std::string & | getlogfilename () const |
| Retrieve current log file name. | |
| bool | logisstderr () const |
| Logging to stderr ? | |
| void | logthedate (bool onoff) |
| turn date logging on or off (default is off) | |
| bool | loggingdate () const |
| void | setdateformat (const std::string fmt) |
| Set the date format, as an strftime() format string. | |
| const char * | datestring () |
| Call with log locked. | |
| std::recursive_mutex & | getmutex () |
Static Public Member Functions | |
| static Logger * | getTheLog (const std::string &fn=std::string()) |
| Initialize logging to file name. | |
| static void | cleanup () |
This is a singleton class.
The logger pointer is obtained when needed by calls to getTheLog(), only the first of which actually creates the object and initializes the output.
| enum Logger::LogLevel |
Log level values.
Messages at level above the current will not be printed. Messages at a level above LOGGER_STATICVERBOSITY will not even be compiled in.
|
inline |
Retrieve the output stream in case you need to write directly to it.
In a multithreaded program, you probably also need to obtain the mutex with getmutex, and lock it.
|
static |
Initialize logging to file name.
Use "stderr" for stderr output. Creates the singleton logger object. Only the first call changes the state, further ones just return the Logger pointer.
| bool Logger::reopen | ( | const std::string & | fn | ) |
Close and reopen the output file.
For rotating the log: rename then reopen.
|
inline |
Set the date format, as an strftime() format string.
Default: "%Y%m%d-%H%M%S" .