libstp
Robotics library for Botball
Loading...
Searching...
No Matches
logging.hpp File Reference
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <spdlog/fmt/bundled/format.h>
Include dependency graph for logging.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  spdlog
namespace  logging
namespace  logging::detail

Macros

#define LIBSTP_LOG_LEVEL_TRACE   0
#define LIBSTP_LOG_LEVEL_DEBUG   1
#define LIBSTP_LOG_LEVEL_INFO   2
#define LIBSTP_LOG_LEVEL_WARN   3
#define LIBSTP_LOG_LEVEL_ERROR   4
#define LIBSTP_LOG_LEVEL_CRITICAL   5
#define LIBSTP_LOG_LEVEL_OFF   6
#define FOUNDATION_LOG_ACTIVE_LEVEL   LIBSTP_LOG_LEVEL_DEBUG
#define LIBSTP_LOG_CALL(level_enum, fmt, ...)
#define LIBSTP_LOG_TRACE(fmt, ...)
#define LIBSTP_LOG_DEBUG(fmt, ...)
#define LIBSTP_LOG_INFO(fmt, ...)
#define LIBSTP_LOG_WARN(fmt, ...)
#define LIBSTP_LOG_ERROR(fmt, ...)
#define LIBSTP_LOG_CRITICAL(fmt, ...)

Enumerations

enum class  logging::Level : int {
  logging::trace = LIBSTP_LOG_LEVEL_TRACE , logging::debug = LIBSTP_LOG_LEVEL_DEBUG , logging::info = LIBSTP_LOG_LEVEL_INFO , logging::warn = LIBSTP_LOG_LEVEL_WARN ,
  logging::error = LIBSTP_LOG_LEVEL_ERROR , logging::critical = LIBSTP_LOG_LEVEL_CRITICAL , logging::off = LIBSTP_LOG_LEVEL_OFF
}
 Runtime severity used by the foundation logger and its Python bindings. More...

Functions

constexpr int logging::detail::level_value (Level level)
constexpr const char * logging::detail::basename (const char *path)
void logging::initialize_timer ()
 Reset the relative elapsed-time clock used by the log formatter.
void logging::init ()
 Initialize the shared logger, sinks, and formatter. Safe to call more than once.
bool logging::is_enabled (Level level)
void logging::log (Level level, std::string_view message)
 Log a preformatted message without source-location context.
void logging::log (Level level, const char *source_file, int line, const char *func, std::string_view message)
template<typename... Args>
void logging::logf (Level level, std::string_view fmt_str, Args &&... args)
template<typename... Args>
void logging::logf_loc (Level level, const char *file, int line, const char *func, std::string_view fmt_str, Args &&... args)
void logging::shutdown ()
std::shared_ptr< spdlog::logger > logging::core ()
 Access the shared spdlog logger after initialization.

Macro Definition Documentation

◆ FOUNDATION_LOG_ACTIVE_LEVEL

#define FOUNDATION_LOG_ACTIVE_LEVEL   LIBSTP_LOG_LEVEL_DEBUG

Definition at line 24 of file logging.hpp.

◆ LIBSTP_LOG_CALL

#define LIBSTP_LOG_CALL ( level_enum,
fmt,
... )
Value:
do { \
::logging::logf_loc(level_enum, __FILE__, __LINE__, \
static_cast<const char*>(__FUNCTION__), \
fmt __VA_OPT__(, __VA_ARGS__)); \
} \
} while (0)
#define FOUNDATION_LOG_ACTIVE_LEVEL
Definition logging.hpp:24
constexpr int level_value(Level level)
Definition logging.hpp:43

Definition at line 130 of file logging.hpp.

◆ LIBSTP_LOG_CRITICAL

#define LIBSTP_LOG_CRITICAL ( fmt,
... )
Value:
LIBSTP_LOG_CALL(::logging::Level::critical, fmt __VA_OPT__(, __VA_ARGS__))
#define LIBSTP_LOG_CALL(level_enum, fmt,...)
Definition logging.hpp:130

Definition at line 144 of file logging.hpp.

◆ LIBSTP_LOG_DEBUG

#define LIBSTP_LOG_DEBUG ( fmt,
... )
Value:
LIBSTP_LOG_CALL(::logging::Level::debug, fmt __VA_OPT__(, __VA_ARGS__))

Definition at line 140 of file logging.hpp.

◆ LIBSTP_LOG_ERROR

#define LIBSTP_LOG_ERROR ( fmt,
... )
Value:
LIBSTP_LOG_CALL(::logging::Level::error, fmt __VA_OPT__(, __VA_ARGS__))

Definition at line 143 of file logging.hpp.

◆ LIBSTP_LOG_INFO

#define LIBSTP_LOG_INFO ( fmt,
... )
Value:
LIBSTP_LOG_CALL(::logging::Level::info, fmt __VA_OPT__(, __VA_ARGS__))

Definition at line 141 of file logging.hpp.

◆ LIBSTP_LOG_LEVEL_CRITICAL

#define LIBSTP_LOG_LEVEL_CRITICAL   5

Definition at line 16 of file logging.hpp.

◆ LIBSTP_LOG_LEVEL_DEBUG

#define LIBSTP_LOG_LEVEL_DEBUG   1

Definition at line 12 of file logging.hpp.

◆ LIBSTP_LOG_LEVEL_ERROR

#define LIBSTP_LOG_LEVEL_ERROR   4

Definition at line 15 of file logging.hpp.

◆ LIBSTP_LOG_LEVEL_INFO

#define LIBSTP_LOG_LEVEL_INFO   2

Definition at line 13 of file logging.hpp.

◆ LIBSTP_LOG_LEVEL_OFF

#define LIBSTP_LOG_LEVEL_OFF   6

Definition at line 17 of file logging.hpp.

◆ LIBSTP_LOG_LEVEL_TRACE

#define LIBSTP_LOG_LEVEL_TRACE   0

Definition at line 11 of file logging.hpp.

◆ LIBSTP_LOG_LEVEL_WARN

#define LIBSTP_LOG_LEVEL_WARN   3

Definition at line 14 of file logging.hpp.

◆ LIBSTP_LOG_TRACE

#define LIBSTP_LOG_TRACE ( fmt,
... )
Value:
LIBSTP_LOG_CALL(::logging::Level::trace, fmt __VA_OPT__(, __VA_ARGS__))

Definition at line 139 of file logging.hpp.

◆ LIBSTP_LOG_WARN

#define LIBSTP_LOG_WARN ( fmt,
... )
Value:
LIBSTP_LOG_CALL(::logging::Level::warn, fmt __VA_OPT__(, __VA_ARGS__))

Definition at line 142 of file logging.hpp.