XBotInterface  2.4.1
XBotInterface provides a generic API to model and control a robot.
Public Types | Static Public Member Functions | List of all members
XBot::Logger Class Reference

#include <RtLog.hpp>

+ Collaboration diagram for XBot::Logger:

Public Types

enum  Severity {
  Severity::DEBUG = -1,
  Severity::LOW = 0,
  Severity::MID = 1,
  Severity::HIGH = 2,
  Severity::FATAL = 3
}
 

Static Public Member Functions

static std::ostream & log ()
 Writes to the internal stream with no special formatting and without changing the severity level (which defaults to HIGH). More...
 
static std::ostream & info (Logger::Severity s=Logger::Severity::LOW)
 Logs an information message (with bold [INFO] header). More...
 
static void info (Logger::Severity s, const char *fmt,...)
 Logs an information message (with bold [INFO] header). More...
 
static void info (const char *fmt,...)
 Logs an information message (with bold [INFO] header). More...
 
static std::ostream & error (Logger::Severity s=Logger::Severity::HIGH)
 Logs an error message (in red, with bold [ERROR] header). More...
 
static void error (Logger::Severity s, const char *fmt,...)
 Logs an error message (with bold [error] header). More...
 
static void error (const char *fmt,...)
 Logs an error message (with bold [error] header). More...
 
static std::ostream & warning (Logger::Severity s=Logger::Severity::MID)
 Logs a warning message (in yellow, with bold [warning] header). More...
 
static void warning (Logger::Severity s, const char *fmt,...)
 Logs a warning message (with bold [warning] header). More...
 
static void warning (const char *fmt,...)
 Logs a warning message (with bold [warning] header). More...
 
static std::ostream & success (Logger::Severity s=Logger::Severity::LOW)
 Logs a success message (in green, with bold [OK] header). More...
 
static void success (Logger::Severity s, const char *fmt,...)
 Logs a success message (with bold [success] header). More...
 
static void success (const char *fmt,...)
 Logs an information message (with bold [INFO] header). More...
 
static Endlendl ()
 Closes the message and prints to screen. More...
 
static void SetVerbosityLevel (Logger::Severity s)
 Sets the global verbosity level, i.e. More...
 
static Logger::Severity GetVerbosityLevel ()
 Sets the global verbosity level, i.e. More...
 
static void SetOnPrintCallback (std::function< void(char *, int, Logger::Severity)> f)
 Sets the on print callback. More...
 

Member Enumeration Documentation

◆ Severity

Enumerator
DEBUG 
LOW 
MID 
HIGH 
FATAL 

Member Function Documentation

◆ endl()

Endl & XBot::Logger::endl ( )
static

Closes the message and prints to screen.

◆ error() [1/3]

void XBot::Logger::error ( const char *  fmt,
  ... 
)
static

Logs an error message (with bold [error] header).

Parameters
fmtFormatted string (printf-like)

◆ error() [2/3]

void XBot::Logger::error ( Logger::Severity  s,
const char *  fmt,
  ... 
)
static

Logs an error message (with bold [error] header).

Parameters
sMessage severity. Defaults to HIGH.
fmtFormatted string (printf-like)
...Values for the formatted string (printf-like)

◆ error() [3/3]

std::ostream & XBot::Logger::error ( Logger::Severity  s = Logger::Severity::HIGH)
static

Logs an error message (in red, with bold [ERROR] header).

Parameters
sMessage severity. Defaults to HIGH.
Returns
Reference to std::ostream (it enables to leverage the same interface as std::cout / cerr)

◆ GetVerbosityLevel()

Logger::Severity XBot::Logger::GetVerbosityLevel ( )
static

Sets the global verbosity level, i.e.

the minimum severity that a message must have in order to actually be printed.

◆ info() [1/3]

void XBot::Logger::info ( const char *  fmt,
  ... 
)
static

Logs an information message (with bold [INFO] header).

Parameters
fmtFormatted string (printf-like)

◆ info() [2/3]

void XBot::Logger::info ( Logger::Severity  s,
const char *  fmt,
  ... 
)
static

Logs an information message (with bold [INFO] header).

Parameters
sMessage severity. Defaults to LOW.
fmtFormatted string (printf-like)
...Values for the formatted string (printf-like)

◆ info() [3/3]

std::ostream & XBot::Logger::info ( Logger::Severity  s = Logger::Severity::LOW)
static

Logs an information message (with bold [INFO] header).

Parameters
sMessage severity. Defaults to LOW.
Returns
Reference to std::ostream (it enables to leverage the same interface as std::cout / cerr)

◆ log()

std::ostream & XBot::Logger::log ( )
static

Writes to the internal stream with no special formatting and without changing the severity level (which defaults to HIGH).

Returns
Reference to std::ostream (it enables to leverage the same interface as std::cout / cerr)

◆ SetOnPrintCallback()

void XBot::Logger::SetOnPrintCallback ( std::function< void(char *, int, Logger::Severity)>  f)
static

Sets the on print callback.

The user can customize the printing behavior by providing a custom function to the underlying logger.

◆ SetVerbosityLevel()

void XBot::Logger::SetVerbosityLevel ( Logger::Severity  s)
static

Sets the global verbosity level, i.e.

the minimum severity that a message must have in order to actually be printed.

◆ success() [1/3]

void XBot::Logger::success ( const char *  fmt,
  ... 
)
static

Logs an information message (with bold [INFO] header).

Parameters
fmtFormatted string (printf-like)

◆ success() [2/3]

void XBot::Logger::success ( Logger::Severity  s,
const char *  fmt,
  ... 
)
static

Logs a success message (with bold [success] header).

Parameters
sMessage severity. Defaults to HIGH.
fmtFormatted string (printf-like)
...Values for the formatted string (printf-like)

◆ success() [3/3]

std::ostream & XBot::Logger::success ( Logger::Severity  s = Logger::Severity::LOW)
static

Logs a success message (in green, with bold [OK] header).

Parameters
sMessage severity. Defaults to LOW.
Returns
Reference to std::ostream (it enables to leverage the same interface as std::cout / cerr)

◆ warning() [1/3]

void XBot::Logger::warning ( const char *  fmt,
  ... 
)
static

Logs a warning message (with bold [warning] header).

Parameters
fmtFormatted string (printf-like)

◆ warning() [2/3]

void XBot::Logger::warning ( Logger::Severity  s,
const char *  fmt,
  ... 
)
static

Logs a warning message (with bold [warning] header).

Parameters
sMessage severity. Defaults to HIGH.
fmtFormatted string (printf-like)
...Values for the formatted string (printf-like)

◆ warning() [3/3]

std::ostream & XBot::Logger::warning ( Logger::Severity  s = Logger::Severity::MID)
static

Logs a warning message (in yellow, with bold [warning] header).

Parameters
sMessage severity. Defaults to MEDIUM.
Returns
Reference to std::ostream (it enables to leverage the same interface as std::cout / cerr)

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