Gazebo Common

API Reference

6.0.1

Container for loggers, and global logging options (such as verbose vs. quiet output). More...

#include <common/common.hh>

Public Member Functions

 Console (const std::string &_loggerName)
 Class constructor.
 

Static Public Member Functions

static void Close ()
 Detach fhe file sink from the global logger. After this call, console logging will keep working but no file logging.
 
static std::string Directory ()
 Get the full path of the directory where all the log files are stored.
 
static bool Init (const std::string &_directory, const std::string &_filename)
 Initialize the global logger.
 
static std::string Prefix ()
 Get custom prefix. This is empty by default.
 
static ConsoleRoot ()
 Access the global gz console logger.
 
static void SetPrefix (const std::string &_customPrefix)
 Add a custom prefix in front of the default prefixes.
 
static void SetVerbosity (const int _level)
 Set verbosity, where 0: Critical messages, 1: Critical, error messages, 2: Critical, error and warning messages, 3: Critical, error, warning, and info messages, 4: Critical, error, warning, info, and debug messages. 5: Critical, error, warning, info, debug, and trace messages.
 
static int Verbosity ()
 Get the verbose level.
 

Static Public Attributes

static bool initialized
 True if initialized.
 

Detailed Description

Container for loggers, and global logging options (such as verbose vs. quiet output).

Constructor & Destructor Documentation

◆ Console()

Console ( const std::string _loggerName)
explicit

Class constructor.

Parameters
[in]_loggerNameLogger name.

Member Function Documentation

◆ Close()

static void Close ( )
static

Detach fhe file sink from the global logger. After this call, console logging will keep working but no file logging.

◆ Directory()

static std::string Directory ( )
static

Get the full path of the directory where all the log files are stored.

Returns
Full path of the directory.

◆ Init()

static bool Init ( const std::string _directory,
const std::string _filename 
)
static

Initialize the global logger.

Parameters
[in]_directoryName of directory that holds the log file.
[in]_filenameName of the log file to write output into.
Returns
True when the initialization succeed or false otherwise.

◆ Prefix()

static std::string Prefix ( )
static

Get custom prefix. This is empty by default.

Returns
The custom prefix.
See also
void SetPrefix(const std::string &_customPrefix)

◆ Root()

static Console & Root ( )
static

Access the global gz console logger.

Returns
The gz consoler logger.

◆ SetPrefix()

static void SetPrefix ( const std::string _customPrefix)
static

Add a custom prefix in front of the default prefixes.

By default, the custom prefix is an empty string, so the messages start as:

[Err], [Wrn], [Msg], [Dbg]

If you set the prefix to "-my-", for example, they become:

-my-[Err], -my-[Wrn], -my-[Msg], -my-[Dbg]

Parameters
[in]_customPrefixPrefix string.
See also
std::string Prefix() const

◆ SetVerbosity()

static void SetVerbosity ( const int  _level)
static

Set verbosity, where 0: Critical messages, 1: Critical, error messages, 2: Critical, error and warning messages, 3: Critical, error, warning, and info messages, 4: Critical, error, warning, info, and debug messages. 5: Critical, error, warning, info, debug, and trace messages.

Parameters
[in]_levelThe new verbose level.

◆ Verbosity()

static int Verbosity ( )
static

Get the verbose level.

Returns
The level of verbosity.
See also
SetVerbosity(const int _level)

Member Data Documentation

◆ initialized

bool initialized
static

True if initialized.


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