bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitrl_log.h File Reference

bitrl's logging: the logger of bitsim, bitsim/utils/logger.h, with bitrl's messages going to the logger named "bitrl". More...

Include dependency graph for bitrl_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  bitrl
 Various utilities used when working with RL problems.
namespace  bitrl::log

Macros

#define BITRL_LOG_TRACE   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::trace)
#define BITRL_LOG_DEBUG   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::debug)
#define BITRL_LOG_INFO   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::info)
#define BITRL_LOG_WARN   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::warn)
#define BITRL_LOG_ERROR   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::error)
#define BITRL_LOG_CRITICAL   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::critical)

Enumerations

enum class  bitrl::log::Level
 The severity of a message, and the lowest severity a logger writes. More...

Functions

void bitrl::log::add_file_sink (const std::string &filename, bool truncate=true)
 Write the messages of every logger to a file as well.
void bitrl::log::flush ()
 Write out what the sinks hold.
Level bitrl::log::get_level (const std::string &logger)
 The level of the logger with the given name, making it if needed.
void bitrl::log::set_level (Level level)
 Set the level of every logger, and of the loggers made later.
void bitrl::log::set_pattern (const std::string &pattern)
 Set the format of the messages of every sink, in spdlog's pattern syntax. The default is "[%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v": the time, the logger, the level and the message.

Detailed Description

bitrl's logging: the logger of bitsim, bitsim/utils/logger.h, with bitrl's messages going to the logger named "bitrl".

BITRL_LOG_INFO << "Episode " << episode << " reward " << reward;
// only warnings and above from bitrl, everything else unchanged
bitrl::log::set_level("bitrl", bitrl::log::Level::warn);
#define BITRL_LOG_INFO
Definition bitrl_log.h:36
void set_level(Level level)
Set the level of every logger, and of the loggers made later.
Definition logger.cpp:165

The SPDLOG_LEVEL environment variable sets the levels without changing the code: SPDLOG_LEVEL=bitrl=warn does the same as the call above.

Macro Definition Documentation

◆ BITRL_LOG_CRITICAL

#define BITRL_LOG_CRITICAL   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::critical)

◆ BITRL_LOG_DEBUG

#define BITRL_LOG_DEBUG   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::debug)

◆ BITRL_LOG_ERROR

#define BITRL_LOG_ERROR   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::error)

◆ BITRL_LOG_INFO

#define BITRL_LOG_INFO   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::info)

◆ BITRL_LOG_TRACE

#define BITRL_LOG_TRACE   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::trace)

◆ BITRL_LOG_WARN

#define BITRL_LOG_WARN   BITSIM_LOG_TO("bitrl", ::bitsim::log::Level::warn)