Contains information about the origin and the content of a log message. More...
#include "Logger.h"
Public Member Functions | |
LogMessage () | |
LogMessage (const std::string &_serviceName, const std::string &_functionName, const std::string &_text, const LogFlags &_flags=LogFlags(ot::INFORMATION_LOG)) | |
LogMessage (const LogMessage &_other) | |
virtual | ~LogMessage () |
LogMessage & | operator= (const LogMessage &_other) |
void | setServiceName (const std::string &_serviceName) |
const std::string & | getServiceName (void) const |
void | setFunctionName (const std::string &_functionName) |
const std::string & | getFunctionName (void) const |
void | setText (const std::string &_text) |
const std::string & | getText (void) const |
void | setFlags (const LogFlags &_flags) |
const LogFlags & | getFlags (void) const |
void | setLocalSystemTime (const std::string &_timeString) |
const std::string & | getLocalSystemTime (void) const |
String representation of the system timestamp at message creation. OT_LOG_TIME_FORMAT_STDSTRING contains the string format. | |
void | setGlobalSystemTime (const std::string &_timeString) |
const std::string & | getGlobalSystemTime (void) const |
String representation of the system timestamp at when the message was received by the Logger Service. OT_LOG_TIME_FORMAT_STDSTRING contains the string format. | |
void | setCurrentTimeAsLocalSystemTime (void) |
Set the current system time as message creation timestamp. | |
void | setCurrentTimeAsGlobalSystemTime (void) |
Set the current system time as message received by logger service timestamp. | |
void | setUserName (const std::string &_userName) |
const std::string & | getUserName (void) const |
void | setProjectName (const std::string &_projectName) |
const std::string & | getProjectName (void) const |
virtual void | addToJsonObject (JsonValue &_object, JsonAllocator &_allocator) const override |
Add the object contents to the provided JSON object. | |
virtual void | setFromJsonObject (const ConstJsonObject &_object) override |
Will set the object contents from the provided JSON object. | |
Public Member Functions inherited from ot::Serializable | |
Serializable () | |
virtual | ~Serializable () |
virtual void | addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const =0 |
Add the object contents to the provided JSON object. | |
Friends | |
OT_CORE_API_EXPORT std::ostream & | operator<< (std::ostream &_stream, const LogMessage &_msg) |
Writes the log message in a typical "log line" format to the provided output stream. | |
Contains information about the origin and the content of a log message.
ot::LogMessage::LogMessage | ( | ) |
ot::LogMessage::LogMessage | ( | const std::string & | _serviceName, |
const std::string & | _functionName, | ||
const std::string & | _text, | ||
const LogFlags & | _flags = LogFlags(ot::INFORMATION_LOG) ) |
ot::LogMessage::LogMessage | ( | const LogMessage & | _other | ) |
|
virtual |
|
overridevirtual |
Add the object contents to the provided JSON object.
_document | The JSON document (used to get the allocator). |
_object | The JSON object to add the contents to. |
|
inline |
|
inline |
|
inline |
|
inline |
String representation of the system timestamp at message creation. OT_LOG_TIME_FORMAT_STDSTRING contains the string format.
|
inline |
|
inline |
|
inline |
|
inline |
ot::LogMessage & ot::LogMessage::operator= | ( | const LogMessage & | _other | ) |
void ot::LogMessage::setCurrentTimeAsGlobalSystemTime | ( | void | ) |
Set the current system time as message received by logger service timestamp.
void ot::LogMessage::setCurrentTimeAsLocalSystemTime | ( | void | ) |
Set the current system time as message creation timestamp.
|
inline |
|
overridevirtual |
Will set the object contents from the provided JSON object.
_object | The JSON object containing the information. |
Will | throw an exception if the provided object is not valid (members missing or invalid types). |
Implements ot::Serializable.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
Writes the log message in a typical "log line" format to the provided output stream.
_stream | Output stream to write to. |
_msg | The log message to write. |