Kanzi Connect  1.1.10
Kanzi Connect C++ API
kanzi::connect::LoggerBase Class Reference

This is a base class for connect specific loggers. More...

#include <loggerbase.hpp>

Public Types

enum  {
  FeatureTimestamp = (1 << 0), FeatureLevel = (1 << 1), FeatureThreadId = (1 << 2), FeatureLocation = (1 << 3),
  FeatureFilenameAsTag = (1 << 4)
}
 

Public Member Functions

 LoggerBase (LogLevel &dynamicLogLevel, uint32_t &features)
 Dynamic log level. More...
 

Protected Member Functions

bool levelEnabled (LogLevel level) const
 Is loglevel enabled and allowed to log. More...
 

Static Protected Member Functions

static void getLevelPrefix (LogLevel level, stringstream &ss)
 Retrieve a log level prefix. More...
 
static void getLocation (string_view file, int line, stringstream &ss)
 Retrieves the location. More...
 
static string getStrippedFilename (string_view file)
 retrieves a stripped filename without the path information. More...
 
static void getThreadId (stringstream &ss)
 Retrieve thread identifier as string. More...
 
static void getTimestamp (stringstream &ss)
 Retrieve the timetamp as string in iso format. More...
 

Protected Attributes

LogLevel & m_dynamicLogLevel
 The dynamic loglevel. More...
 
uint32_t & m_features
 available features if any. More...
 

Detailed Description

This is a base class for connect specific loggers.

not to be used as is.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
FeatureTimestamp 

Timestamp will be logged.

FeatureLevel 

Log level (INF, ERR, WRN etc will be logged).

FeatureThreadId 

Thread identifier will be logged.

FeatureLocation 

Logging location (file:linenumber) will be added to end ot the logrow.

FeatureFilenameAsTag 

Use plain filename (c:\temp\log.cpp -> [log]) as logging token.

Constructor & Destructor Documentation

◆ LoggerBase()

kanzi::connect::LoggerBase::LoggerBase ( LogLevel &  dynamicLogLevel,
uint32_t &  features 
)

Dynamic log level.

Parameters
dynamicLogLevelreference to variable that will hold the dynamic loglevel.

Member Function Documentation

◆ getLevelPrefix()

static void kanzi::connect::LoggerBase::getLevelPrefix ( LogLevel  level,
stringstream &  ss 
)
staticprotected

Retrieve a log level prefix.

Parameters
levelthe log level
sswill be appended with prefix.

◆ getLocation()

static void kanzi::connect::LoggerBase::getLocation ( string_view  file,
int  line,
stringstream &  ss 
)
staticprotected

Retrieves the location.

Parameters
filefilename
lineline number of the logging.
sswhere to append the string.

◆ getStrippedFilename()

static string kanzi::connect::LoggerBase::getStrippedFilename ( string_view  file)
staticprotected

retrieves a stripped filename without the path information.

Parameters
filethe file with path and extension.
Returns
stripped filename.

◆ getThreadId()

static void kanzi::connect::LoggerBase::getThreadId ( stringstream &  ss)
staticprotected

Retrieve thread identifier as string.

Parameters
sswill be appended with thread identifier.

◆ getTimestamp()

static void kanzi::connect::LoggerBase::getTimestamp ( stringstream &  ss)
staticprotected

Retrieve the timetamp as string in iso format.

Parameters
sswill be appended the string in ISO format

◆ levelEnabled()

bool kanzi::connect::LoggerBase::levelEnabled ( LogLevel  level) const
protected

Is loglevel enabled and allowed to log.

Returns
true if enabled and allowed to log.

Member Data Documentation

◆ m_dynamicLogLevel

LogLevel& kanzi::connect::LoggerBase::m_dynamicLogLevel
protected

The dynamic loglevel.

◆ m_features

uint32_t& kanzi::connect::LoggerBase::m_features
protected

available features if any.


The documentation for this class was generated from the following file: