|
#include <LogEngine.h>
Public Member Functions | |
| virtual void | saveMessage (const Logger::UMessage &message)=0 |
| LogEngine (const String &logEngineName) | |
| ~LogEngine () noexcept override | |
| virtual void | reset () |
| void | options (int ops) |
| size_t | options () const |
| void | option (int options, bool flag) |
| void | priority (LogPriority prt) |
| virtual void | minPriority (LogPriority prt) |
| virtual LogPriority | minPriority () const |
Public Member Functions inherited from sptk::Thread | |
| Thread (const String &name, const std::shared_ptr< ThreadManager > &threadManager=nullptr) | |
| virtual | ~Thread () |
| virtual void | run () |
| bool | running () const |
| virtual void | threadFunction ()=0 |
| virtual void | terminate () |
| virtual void | onThreadExit () |
| virtual bool | terminated () |
| virtual void | join () |
| Id | id () const |
| const String & | name () const |
| virtual bool | sleep_for (std::chrono::milliseconds interval) |
| virtual bool | sleep_until (const DateTime ×tamp) |
Static Public Member Functions | |
| static String | priorityName (LogPriority prt) |
| static LogPriority | priorityFromName (const String &prt) |
Protected Member Functions | |
| void | threadFunction () override |
| void | log (Logger::UMessage &message) |
| void | shutdown () noexcept |
Friends | |
| class | Logger |
Additional Inherited Members | |
Public Types inherited from sptk::Thread | |
| using | Id = std::thread::id |
Base class for various log engines.
This class is abstract. Derived classes have to implement at least saveMessage() method.
|
explicit |
Constructor
Creates a new log object.
|
overridenoexcept |
Destructor
|
protected |
Log a message
| message | Message |
|
inlinevirtual |
Returns the min priority
Messages with priority less than requested are ignored
|
inlinevirtual |
Sets min message priority
Messages with priority less than requested are ignored
| prt | LogPriority, min message priority |
| void sptk::LogEngine::option | ( | int | options, |
| bool | flag | ||
| ) |
Sets an option to true or false
| option | Log option, one or more of LO_* constants |
| flag | Set option on or off? |
|
inline |
Returns log options
|
inline |
Sets log options
| ops | int, a bit combination of Option |
|
inline |
Sets current message priority
| prt | LogPriority, current message priority |
|
static |
Priotrity from string representation
|
static |
String representation of priority
|
inlinevirtual |
Restarts the log
The current log content is cleared. Actual result depends on derived log engine.
Reimplemented in sptk::FileLogEngine.
|
pure virtual |
Stores or sends log message to actual destination
| message | Log message |
Implemented in sptk::FileLogEngine, and sptk::SysLogEngine.
|
protectednoexcept |
Shutdown log worker thread
References INFO.
|
overrideprotectedvirtual |
The thread function. Should be overwritten by the derived class.
Implements sptk::Thread.