Jpp
master_rocky
the software that should make you happy
|
Message logger. More...
#include <JMessageLogger.hh>
Public Types | |
enum | JLevel_t { OFF = -1 , ERROR = 0 , STATUS = 0 , WARNING = 1 , NOTICE = 2 , DEBUG = 3 } |
typedef std::string | JMessage_t |
Public Member Functions | |
JMessageLogger () | |
Default constructor. More... | |
JMessageLogger (JLogger *__logger, const std::string &__name, const int __level=ERROR) | |
Constructor. More... | |
void | reset (JLogger *__logger=NULL) |
Reset logger. More... | |
JLevel_t | getLevel () |
Get debug level. More... | |
void | setLevel (const int __level) |
Set debug level. More... | |
void | setLevel (const JLevel_t __level) |
Set debug level. More... | |
bool | is_valid () const |
Check validity of logger object. More... | |
virtual void | typeout (const std::string &tag, const std::string &message) override |
Report message. More... | |
void | debug (const JMessage_t &message) |
void | warning (const JMessage_t &message) |
void | error (const JMessage_t &message) |
void | notice (const JMessage_t &message) |
void | status (const JMessage_t &message) |
JSYNCHRONIZATION::JMutex & | mutex () |
Provides internal lock object. More... | |
Protected Member Functions | |
void | typeout (const JLevel_t __level, const char *__prefix, const JMessage_t &__message) |
Report message. More... | |
Protected Attributes | |
JSharedPointer< JLogger > | logger |
std::string | host |
std::string | name |
JLevel_t | level |
Private Attributes | |
JSYNCHRONIZATION::JMutex | m_mutex |
Message logger.
The class implements the following message functions:
The argument of these messages is an STL string.
The message reported consists of <date time> <host name> <process name> <prefix> <message>
where the prefix is "DEBUG", "WARNING", "ERROR", "STATUS" or "NOTICE".
A debug level can be specified which is used to filter the message types for reporting.
The level OFF will cause the message logger to stop reporting any messages.
Note that the JXXXStreamer classes can be used for STL ostream compatible message logging (see JMessageStream.hh).
Definition at line 53 of file JMessageLogger.hh.
typedef std::string JLOGGER::JMessageLogger::JMessage_t |
Definition at line 67 of file JMessageLogger.hh.
Enumerator | |
---|---|
OFF | No logging of messages. |
ERROR | Error; always logged. |
STATUS | Status; always logged. |
WARNING | Warning. |
NOTICE | Notice. |
DEBUG | Debug. |
Definition at line 58 of file JMessageLogger.hh.
|
inline |
Default constructor.
Definition at line 73 of file JMessageLogger.hh.
|
inline |
Constructor.
__logger | pointer to logger |
__name | name |
__level | debug level |
Definition at line 89 of file JMessageLogger.hh.
|
inline |
Reset logger.
__logger | pointer to logger |
Definition at line 106 of file JMessageLogger.hh.
|
inline |
|
inline |
|
inline |
|
inline |
Check validity of logger object.
This operator returns the state of the logger object. The object is valid if the logger object is ready for use, else the object is in-valid. In case the object is in-valid, no messages will be reported.
Definition at line 163 of file JMessageLogger.hh.
|
inlineoverridevirtual |
Report message.
tag | tag |
message | message |
Implements JLOGGER::JLogger.
Reimplemented in JLOGGER::JMessageScheduler, and JLOGGER::JMessageLoggerThreadSafe.
Definition at line 175 of file JMessageLogger.hh.
|
inline |
Definition at line 184 of file JMessageLogger.hh.
|
inline |
Definition at line 185 of file JMessageLogger.hh.
|
inline |
Definition at line 186 of file JMessageLogger.hh.
|
inline |
Definition at line 187 of file JMessageLogger.hh.
|
inline |
Definition at line 188 of file JMessageLogger.hh.
|
inlineprotected |
Report message.
__level | level |
__prefix | prefix |
__message | message |
Definition at line 200 of file JMessageLogger.hh.
|
inlineinherited |
Provides internal lock object.
Definition at line 44 of file JLogger.hh.
|
protected |
Definition at line 227 of file JMessageLogger.hh.
|
protected |
Definition at line 228 of file JMessageLogger.hh.
|
protected |
Definition at line 229 of file JMessageLogger.hh.
|
protected |
Definition at line 230 of file JMessageLogger.hh.
|
privateinherited |
Definition at line 51 of file JLogger.hh.