15 #ifndef SERIALBOX_CORE_LOGGING_H 16 #define SERIALBOX_CORE_LOGGING_H 29 static NullLogger& getInstance() noexcept;
32 NullLogger& operator<<(T&& t) noexcept {
37 static NullLogger* instance_;
45 template <
class StreamableValueType>
46 LoggerProxy&
operator<<(StreamableValueType&& value) {
56 static Logger& getInstance() noexcept;
58 LoggerProxy trace() noexcept;
59 LoggerProxy debug() noexcept;
60 LoggerProxy info() noexcept;
61 LoggerProxy warning() noexcept;
62 LoggerProxy error() noexcept;
63 LoggerProxy fatal() noexcept;
66 static Logger* instance_;
69 extern
bool LoggingIsEnabled;
81 static void enable() noexcept { internal::LoggingIsEnabled =
true; }
84 static void disable() noexcept { internal::LoggingIsEnabled =
false; }
87 static bool isEnabled() noexcept {
return internal::LoggingIsEnabled; }
102 #define LOG(severity) SERIALBOX_INTERNAL_LOG(severity) 104 #ifdef SERIALBOX_DISABLE_LOGGING 106 #define SERIALBOX_INTERNAL_LOG(severity) \ 108 serialbox::internal::NullLogger::getInstance() 112 #define SERIALBOX_INTERNAL_LOG(severity) \ 113 if(serialbox::Logging::isEnabled()) \ 114 serialbox::internal::Logger::getInstance().severity() static void enable() noexcept
Disable logging.
Namespace of the serialbox library.
static bool isEnabled() noexcept
Return true if logging is eneabled.
Control the logging behaviour.
static void disable() noexcept
Enable logging.
std::ostream & operator<<(std::ostream &stream, const FieldID &f)
Convert FieldID to stream.