Gazebo Common

API Reference

6.0.0
Console.hh File Reference
#include <spdlog/logger.h>
#include <spdlog/spdlog.h>
#include <fstream>
#include <iostream>
#include <ostream>
#include <sstream>
#include <string>
#include <gz/common/Export.hh>
#include <gz/common/Util.hh>
#include <gz/utils/log/Logger.hh>
#include <gz/utils/SuppressWarning.hh>

Go to the source code of this file.

Classes

class  Console
 Container for loggers, and global logging options (such as verbose vs. quiet output). More...
 
class  LogMessage
 Helper class for providing gzlog macros. More...
 

Namespaces

namespace  gz
 Forward declarations for the common classes.
 
namespace  gz::common
 

Macros

#define gzcrit
 Output a critical message.
 
#define gzdbg
 Output a debug message.
 
#define gzerr
 Output an error message.
 
#define gzlog
 Output a message to a log file.
 
#define gzLogClose()    Console::Close()
 Close the file used for logging.
 
#define gzLogDirectory()    (Console::Directory())
 Get the full path of the directory where the log files are stored.
 
#define gzLogInit(_dir, _file)    Console::Init(_dir, _file)
 Initialize log file with filename given by _dir/_file. If called twice, it will close the file currently in use and open a new log file.
 
#define gzmsg
 Output a message.
 
#define gztrace
 Output a trace message.
 
#define gzwarn
 Output a warning message.
 

Macro Definition Documentation

◆ gzcrit

#define gzcrit
Value:
(LogMessage( \
__FILE__, __LINE__, spdlog::level::critical).stream())

Output a critical message.

◆ gzdbg

#define gzdbg
Value:
LogMessage( \
__FILE__, __LINE__, spdlog::level::debug).stream()

Output a debug message.

◆ gzerr

#define gzerr
Value:
LogMessage( \
__FILE__, __LINE__, spdlog::level::err).stream()

Output an error message.

◆ gzlog

#define gzlog
Value:
LogMessage( \
__FILE__, __LINE__, spdlog::level::trace).stream()

Output a message to a log file.

◆ gzLogClose

#define gzLogClose ( )     Console::Close()

Close the file used for logging.

◆ gzLogDirectory

#define gzLogDirectory ( )     (Console::Directory())

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

Returns
Full path of the directory

◆ gzLogInit

#define gzLogInit (   _dir,
  _file 
)     Console::Init(_dir, _file)

Initialize log file with filename given by _dir/_file. If called twice, it will close the file currently in use and open a new log file.

Parameters
[in]_dirName of directory in which to store the log file. Note that if _dir is not an absolute path, then _dir will be relative to your home directory.
[in]_fileName of log file for gzlog messages.

◆ gzmsg

#define gzmsg
Value:
LogMessage( \
__FILE__, __LINE__, spdlog::level::info).stream()

Output a message.

◆ gztrace

#define gztrace
Value:
LogMessage( \
__FILE__, __LINE__, spdlog::level::trace).stream()

Output a trace message.

◆ gzwarn

#define gzwarn
Value:
LogMessage( \
__FILE__, __LINE__, spdlog::level::warn).stream()

Output a warning message.