microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Macros
macros.hpp File Reference

Source-location-aware structured logging macros. More...

#include "logger.hpp"
#include <source_location>
Include dependency graph for macros.hpp:

Go to the source code of this file.

Macros

#define MICROFMT_LOGGER_LOG(logger_instance, lvl, fmt, ...)
 
#define MICROFMT_LOGGER_TRACE(logger, fmt, ...)    MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::trace, fmt, __VA_ARGS__)
 
#define MICROFMT_LOGGER_DEBUG(logger, fmt, ...)    MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::debug, fmt, __VA_ARGS__)
 
#define MICROFMT_LOGGER_INFO(logger, fmt, ...)    MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::info, fmt, __VA_ARGS__)
 
#define MICROFMT_LOGGER_WARN(logger, fmt, ...)    MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::warn, fmt, __VA_ARGS__)
 
#define MICROFMT_LOGGER_ERROR(logger, fmt, ...)    MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::err, fmt, __VA_ARGS__)
 
#define MICROFMT_LOGGER_CRITICAL(logger, fmt, ...)    MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::critical, fmt, __VA_ARGS__)
 

Detailed Description

Source-location-aware structured logging macros.

Macro Definition Documentation

◆ MICROFMT_LOGGER_CRITICAL

#define MICROFMT_LOGGER_CRITICAL (   logger,
  fmt,
  ... 
)     MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::critical, fmt, __VA_ARGS__)

◆ MICROFMT_LOGGER_DEBUG

#define MICROFMT_LOGGER_DEBUG (   logger,
  fmt,
  ... 
)     MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::debug, fmt, __VA_ARGS__)

◆ MICROFMT_LOGGER_ERROR

#define MICROFMT_LOGGER_ERROR (   logger,
  fmt,
  ... 
)     MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::err, fmt, __VA_ARGS__)

◆ MICROFMT_LOGGER_INFO

#define MICROFMT_LOGGER_INFO (   logger,
  fmt,
  ... 
)     MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::info, fmt, __VA_ARGS__)

◆ MICROFMT_LOGGER_LOG

#define MICROFMT_LOGGER_LOG (   logger_instance,
  lvl,
  fmt,
  ... 
)
Value:
do { \
if ((logger_instance).should_log(lvl)) { \
(logger_instance).log_loc(::std::source_location::current(), lvl, fmt __VA_OPT__(, ) __VA_ARGS__); \
} \
} while (0)
Definition fmt.hpp:17

◆ MICROFMT_LOGGER_TRACE

#define MICROFMT_LOGGER_TRACE (   logger,
  fmt,
  ... 
)     MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::trace, fmt, __VA_ARGS__)

◆ MICROFMT_LOGGER_WARN

#define MICROFMT_LOGGER_WARN (   logger,
  fmt,
  ... 
)     MICROFMT_LOGGER_LOG(logger, ::microfmt::log::level::warn, fmt, __VA_ARGS__)