Logging

This class provide logging functionalities. Defined in src/utils/Logger.h

class Logger : public TObject

Subclassed by Caesar::ConsoleLogger, Caesar::FileLogger, Caesar::SysLogger

Public Functions

inline Logger(std::string level = "OFF", std::string tag = "logger")

Constructor.

inline virtual ~Logger()

Destructor.

virtual int Init() = 0

Returns log4cxx log level from log4tango log level.

Pure abstract method to initialize logger

inline virtual std::string GetHost() const

Get machine host name.

inline virtual void Log(const std::string sLevel, const std::string msg, const std::string msg_prefix = "")

Log a message (optionally prepended by a prefix) at given log level in string format.

inline virtual void SetLogLevel(const std::string sLevel)

Set logger log level threshold.

class LoggerManager : public TObject

Public Types

enum LogTarget

Define log target enumerations.

Values:

enumerator eSysLog
enumerator eConsole
enumerator eFile

Public Static Functions

static inline LoggerManager &Instance()

Returns unique instance of logger.

static inline int CreateSysLogger(const std::string level, const std::string tag = "syslogger", const std::string facility = "local6")

Create a syslog logger.

static inline int CreateConsoleLogger(const std::string level, const std::string tag = "consolelogger", const std::string target = "System.out")

Create a console logger.

class ConsoleLogger : public Caesar::Logger

Public Functions

inline ConsoleLogger(const std::string level, const std::string tag, const std::string target)

Console logger constructor.

inline virtual ~ConsoleLogger()

Destructor.

inline virtual int Init()

Initialize console logger.

class FileLogger : public Caesar::Logger

Public Functions

inline FileLogger(const std::string level, const std::string tag, const std::string filename, bool appendFlag, const std::string maxFileSize, int maxBackupFiles)

File logger constructor.

inline virtual ~FileLogger()

Destructor.

inline virtual int Init()

Initialize file logger.

class SysLogger : public Caesar::Logger

Public Functions

inline SysLogger(const std::string level, const std::string tag, const std::string facility)

Syslog logger constructor.

inline virtual ~SysLogger()

Destructor.

inline virtual int Init()

Initialize syslog logger.

inline virtual int GetFacilityCode(const std::string syslog_facility) const

Returns syslog facility code.

class ScopedLogger

Public Functions

inline ScopedLogger(std::string level, std::string prefix = "", std::string device_name = "")

Scoped logger constructor.

inline ~ScopedLogger()

Destructor.

inline std::stringstream &stream()

Returns message string stream to be logged.

inline std::string Caesar::getClassName(std::string fullFuncName, std::string funcName)

Returns Tango device name in which log is emitted.

Returns class name in which log is emitted

inline std::string Caesar::getClassNamePrefix(std::string fullFuncName, std::string funcName)

Returns class name prefix in which log is emitted.

__CLASS__

Shortcut macro to get actual class name.

__CLASS_PREFIX__

Shortcut macro to get actual class name prefix.

CAESAR_LOG(DeviceName, Level, What)

Shortcut macro to emit a log message with desired log level inside a given device.

Parameters
  • DeviceName – - Tango device server name

  • Level – - Message log level

  • What – - Message stream to be sent

LOG(Level, What)

Shortcut macro to emit a log message with desired log level.

Parameters
  • Level – - Message log level

  • What – - Message stream to be sent

INFO_LOG(What)

Shortcut macro to emit a log message with INFO log level.

Parameters
  • What – - Message stream to be sent

WARN_LOG(What)

Shortcut macro to emit a log message with WARN log level.

Parameters
  • What – - Message stream to be sent

ERROR_LOG(What)

Shortcut macro to emit a log message with ERROR log level.

Parameters
  • What – - Message stream to be sent

FATAL_LOG(What)

Shortcut macro to emit a log message with FATAL log level.

Parameters
  • What – - Message stream to be sent

DEBUG_LOG(What)

Shortcut macro to emit a log message with DEBUG log level.

Parameters
  • What – - Message stream to be sent