OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
Logger.h File Reference

OpenTwin Logging system. More...

Go to the source code of this file.

Classes

class  ot::LogMessage
 Contains information about the origin and the content of a log message. More...
 
class  ot::AbstractLogNotifier
 Used to receive every log message that is generated. More...
 
class  ot::LogNotifierStdCout
 Used to write created log messages to std cout in a way a human could read it. More...
 
class  ot::LogNotifierFileWriter
 
class  ot::LogDispatcher
 The LogDispatcher dispatches generated log messages to all registered log notifiers. When a log message is dispatched a timestamp for log messages and then forwards them to any registered log notifier. More...
 

Namespaces

namespace  ot
 

Macros

#define OT_LOG_TIME_FORMAT_STDSTRING   "%Y-%m-%d %H:%M:%S"
 Time format string for the timetamps.
 
#define OT_GLOBAL_LOGFLAG_LOGEnabled
 OpenTwin log macros enabled If undefined all the OT_LOG macros wont generate any code (empty line)
 
#define OT_GLOBAL_LOGFLAG_LOG_IEnabled
 OpenTwin log information macros enabled If undefined the OT_LOG_I macros wont generate any code (empty line)
 
#define OT_GLOBAL_LOGFLAG_LOG_DEnabled
 OpenTwin log detailed information macros enabled If undefined the OT_LOG_D macros wont generate any code (empty line)
 
#define OT_GLOBAL_LOGFLAG_LOG_WEnabled
 OpenTwin log warning macros enabled If undefined the OT_LOG_W macros wont generate any code (empty line)
 
#define OT_GLOBAL_LOGFLAG_LOG_EEnabled
 OpenTwin log error macros enabled If undefined the OT_LOG_E macros wont generate any code (empty line)
 
#define OT_LOG(___text, ___flags)   if (ot::LogDispatcher::mayLog(___flags)) { ot::LogDispatcher::instance().dispatch(___text, __FUNCTION__, ___flags); }
 Log a message according to the service logger configuration and the provided flags In debug mode every single log message will be dispatched. In release mode only log messages with "enabled log flags" will be logged (See: LogDispatcher::dispatch(LogMessage))
 
#define OT_LOG_I(___text)   OT_LOG(___text, ot::INFORMATION_LOG)
 Log a information message according to the service logger configuration. Information messages should contain general information.
 
#define OT_LOG_IA(___text)   OTAssert(0, ___text); OT_LOG(___text, ot::INFORMATION_LOG)
 Log a information message according to the service logger configuration and OTAssert with the provided message. Note that the provided text should be a C-String Information messages should contain general information.
 
#define OT_LOG_IAS(___text)   OTAssert(0, ""); OT_LOG(___text, ot::INFORMATION_LOG)
 Log a information message according to the service logger configuration and assert. Information messages should contain general information.
 
#define OT_LOG_D(___text)   OT_LOG(___text, ot::DETAILED_LOG)
 Log a detailed information message according to the service logger configuration. Detailed information messages may contain more information than regular information messages.
 
#define OT_LOG_DA(___text)   OTAssert(0, ___text); OT_LOG(___text, ot::DETAILED_LOG)
 Log a detailed information message according to the service logger configuration and otAssert with the provided message. Note that the provided text should be a C-String Detailed information messages may contain more information than regular information messages.
 
#define OT_LOG_DAS(___text)   OTAssert(0, ""); OT_LOG(___text, ot::DETAILED_LOG)
 Log a detailed information message according to the service logger configuration and assert. Detailed information messages may contain more information than regular information messages.
 
#define OT_LOG_W(___text)   OT_LOG(___text, ot::WARNING_LOG)
 Log a warning message according to the service logger configuration.
 
#define OT_LOG_WA(___text)   OTAssert(0, ___text); OT_LOG(___text, ot::WARNING_LOG)
 Log a warning message according to the service logger configuration and otAssert with the provided message. Note that the provided text should be a C-String.
 
#define OT_LOG_WAS(___text)   OTAssert(0, ""); OT_LOG(___text, ot::WARNING_LOG)
 Log a warning message according to the service logger configuration and assert.
 
#define OT_LOG_E(___text)   OT_LOG(___text, ot::ERROR_LOG)
 Log a error message according to the service logger configuration.
 
#define OT_LOG_EA(___text)   OTAssert(0, ___text); OT_LOG(___text, ot::ERROR_LOG)
 Log a error message according to the service logger configuration and otAssert with the provided message. Note that the provided text should be a C-String.
 
#define OT_LOG_EAS(___text)   OTAssert(0, ""); OT_LOG(___text, ot::ERROR_LOG)
 Log a error message according to the service logger configuration and assert.
 

Typedefs

typedef Flags< LogFlagot::LogFlags
 

Enumerations

enum  ot::LogFlag {
  ot::NO_LOG = 0x0000 , ot::INFORMATION_LOG = 0x0001 , ot::DETAILED_LOG = 0x0002 , ot::WARNING_LOG = 0x0004 ,
  ot::ERROR_LOG = 0x0008 , ot::INBOUND_MESSAGE_LOG = 0x0010 , ot::QUEUED_INBOUND_MESSAGE_LOG = 0x0020 , ot::ONEWAY_TLS_INBOUND_MESSAGE_LOG = 0x0040 ,
  ot::OUTGOING_MESSAGE_LOG = 0x0080 , ot::ALL_GENERAL_LOG_FLAGS = 0x000F , ot::ALL_INCOMING_MESSAGE_LOG_FLAGS = 0x0070 , ot::ALL_OUTGOING_MESSAGE_LOG_FLAGS = 0x0080 ,
  ot::ALL_MESSAGE_LOG_FLAGS = 0x00F0 , ot::ALL_LOG_FLAGS = 0xFFFF
}
 Log message verbouse level. More...
 

Functions

OT_CORE_API_EXPORT void ot::addLogFlagsToJsonArray (const LogFlags &_flags, JsonArray &_flagsArray, JsonAllocator &_allocator)
 
OT_CORE_API_EXPORT LogFlags ot::logFlagsFromJsonArray (const ConstJsonArray &_flagsArray)
 
OT_CORE_API_EXPORT std::ostream & ot::operator<< (std::ostream &_stream, const LogMessage &_msg)
 Writes the log message in a typical "log line" format to the provided output stream.
 

Detailed Description

OpenTwin Logging system.

This file contains the Log functionallity, that any OpenTwin related class should use to generate their log messages.

Author
Alexander Kuester (alexk95)
Date
January 2021

Macro Definition Documentation

◆ OT_GLOBAL_LOGFLAG_LOG_DEnabled

#define OT_GLOBAL_LOGFLAG_LOG_DEnabled

OpenTwin log detailed information macros enabled If undefined the OT_LOG_D macros wont generate any code (empty line)

◆ OT_GLOBAL_LOGFLAG_LOG_EEnabled

#define OT_GLOBAL_LOGFLAG_LOG_EEnabled

OpenTwin log error macros enabled If undefined the OT_LOG_E macros wont generate any code (empty line)

◆ OT_GLOBAL_LOGFLAG_LOG_IEnabled

#define OT_GLOBAL_LOGFLAG_LOG_IEnabled

OpenTwin log information macros enabled If undefined the OT_LOG_I macros wont generate any code (empty line)

◆ OT_GLOBAL_LOGFLAG_LOG_WEnabled

#define OT_GLOBAL_LOGFLAG_LOG_WEnabled

OpenTwin log warning macros enabled If undefined the OT_LOG_W macros wont generate any code (empty line)

◆ OT_GLOBAL_LOGFLAG_LOGEnabled

#define OT_GLOBAL_LOGFLAG_LOGEnabled

OpenTwin log macros enabled If undefined all the OT_LOG macros wont generate any code (empty line)

◆ OT_LOG

#define OT_LOG ( ___text,
___flags )   if (ot::LogDispatcher::mayLog(___flags)) { ot::LogDispatcher::instance().dispatch(___text, __FUNCTION__, ___flags); }

Log a message according to the service logger configuration and the provided flags In debug mode every single log message will be dispatched. In release mode only log messages with "enabled log flags" will be logged (See: LogDispatcher::dispatch(LogMessage))

Parameters
___textThe log message text
___flagsLogFlags describing the type of the created log message

◆ OT_LOG_D

#define OT_LOG_D ( ___text)    OT_LOG(___text, ot::DETAILED_LOG)

Log a detailed information message according to the service logger configuration. Detailed information messages may contain more information than regular information messages.

Parameters
___textThe log message.

◆ OT_LOG_DA

#define OT_LOG_DA ( ___text)    OTAssert(0, ___text); OT_LOG(___text, ot::DETAILED_LOG)

Log a detailed information message according to the service logger configuration and otAssert with the provided message. Note that the provided text should be a C-String Detailed information messages may contain more information than regular information messages.

Parameters
___textThe log message.

◆ OT_LOG_DAS

#define OT_LOG_DAS ( ___text)    OTAssert(0, ""); OT_LOG(___text, ot::DETAILED_LOG)

Log a detailed information message according to the service logger configuration and assert. Detailed information messages may contain more information than regular information messages.

Parameters
___textThe log message.

◆ OT_LOG_E

#define OT_LOG_E ( ___text)    OT_LOG(___text, ot::ERROR_LOG)

Log a error message according to the service logger configuration.

Parameters
___textThe log message.

◆ OT_LOG_EA

#define OT_LOG_EA ( ___text)    OTAssert(0, ___text); OT_LOG(___text, ot::ERROR_LOG)

Log a error message according to the service logger configuration and otAssert with the provided message. Note that the provided text should be a C-String.

Parameters
___textThe log message.

◆ OT_LOG_EAS

#define OT_LOG_EAS ( ___text)    OTAssert(0, ""); OT_LOG(___text, ot::ERROR_LOG)

Log a error message according to the service logger configuration and assert.

Parameters
___textThe log message.

◆ OT_LOG_I

#define OT_LOG_I ( ___text)    OT_LOG(___text, ot::INFORMATION_LOG)

Log a information message according to the service logger configuration. Information messages should contain general information.

Parameters
___textThe log message.

◆ OT_LOG_IA

#define OT_LOG_IA ( ___text)    OTAssert(0, ___text); OT_LOG(___text, ot::INFORMATION_LOG)

Log a information message according to the service logger configuration and OTAssert with the provided message. Note that the provided text should be a C-String Information messages should contain general information.

Parameters
___textThe log message.

◆ OT_LOG_IAS

#define OT_LOG_IAS ( ___text)    OTAssert(0, ""); OT_LOG(___text, ot::INFORMATION_LOG)

Log a information message according to the service logger configuration and assert. Information messages should contain general information.

Parameters
___textThe log message.

◆ OT_LOG_TIME_FORMAT_STDSTRING

#define OT_LOG_TIME_FORMAT_STDSTRING   "%Y-%m-%d %H:%M:%S"

Time format string for the timetamps.

◆ OT_LOG_W

#define OT_LOG_W ( ___text)    OT_LOG(___text, ot::WARNING_LOG)

Log a warning message according to the service logger configuration.

Parameters
___textThe log message.

◆ OT_LOG_WA

#define OT_LOG_WA ( ___text)    OTAssert(0, ___text); OT_LOG(___text, ot::WARNING_LOG)

Log a warning message according to the service logger configuration and otAssert with the provided message. Note that the provided text should be a C-String.

Parameters
___textThe log message.

◆ OT_LOG_WAS

#define OT_LOG_WAS ( ___text)    OTAssert(0, ""); OT_LOG(___text, ot::WARNING_LOG)

Log a warning message according to the service logger configuration and assert.

Parameters
___textThe log message.