bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
logger.cpp File Reference
#include "bitsim/utils/logger.h"
#include <spdlog/cfg/env.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/dist_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <map>
#include <memory>
#include <mutex>
Include dependency graph for logger.cpp:

Classes

struct  bitsim::log::detail::LoggerHandle

Namespaces

namespace  bitsim
namespace  bitsim::log
namespace  bitsim::log::detail

Functions

LoggerHandle * bitsim::log::detail::handle (const std::string &logger)
 The logger with the given name, made the first time. It lives until the program ends.
bool bitsim::log::detail::enabled (LoggerHandle *logger, Level level) noexcept
 Whether the logger writes messages of the given level.
void bitsim::log::detail::write (LoggerHandle *logger, Level level, std::string_view message) noexcept
 Write a message, without its trailing new lines.
void bitsim::log::set_level (Level level)
 Set the level of every logger, and of the loggers made later.
void bitsim::log::set_level (const std::string &logger, Level level)
 Set the level of the logger with the given name, making it if needed.
Level bitsim::log::get_level (const std::string &logger)
 The level of the logger with the given name, making it if needed.
void bitsim::log::add_file_sink (const std::string &filename, bool truncate=true)
 Write the messages of every logger to a file as well.
void bitsim::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.
void bitsim::log::flush ()
 Write out what the sinks hold.