deltaFlow
Logger.H File Reference

Logger utilities for deltaFlow, providing logging macros and a singleton Logger class. More...

#include <chrono>
#include <fmt/chrono.h>
#include <fmt/color.h>
#include <fstream>
#include <iostream>
#include <string>
Include dependency graph for Logger.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Logger
 Singleton logger class for deltaFlow. More...
 

Macros

#define LOG_DEBUG(msg, ...)   Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::DEBUG)
 Macro for logging a debug-level message.
 
#define LOG_INFO(msg, ...)   Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::INFO)
 Macro for logging an info-level message.
 
#define LOG_WARN(msg, ...)   Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::WARN)
 Macro for logging a warning-level message.
 
#define LOG_ERROR(msg, ...)   Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::ERROR)
 Macro for logging an error-level message.
 
#define LOG_CRITICAL(msg, ...)   Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::CRITICAL)
 Macro for logging a critical-level message.
 
#define LOG_MESSAGE(msg, ...)   fmt::print("{}\n", fmt::format(FMT_STRING(msg), ##__VA_ARGS__))
 Macro for printing messages to stdout.
 

Enumerations

enum class  Level : uint8_t {
  NOTSET , DEBUG , INFO , WARN ,
  ERROR , CRITICAL
}
 Log severity levels. More...
 

Detailed Description

Logger utilities for deltaFlow, providing logging macros and a singleton Logger class.

This file declares the logging macros and the Logger class for handling logging at various severity levels. The logger supports logging to a file and console with different levels: NOTSET, DEBUG, INFO, WARN, ERROR, CRITICAL.

Macros (e.g., DEBUG, INFO) simplify use throughout the codebase.

Definition in file Logger.H.

Macro Definition Documentation

◆ LOG_CRITICAL

#define LOG_CRITICAL (   msg,
  ... 
)    Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::CRITICAL)

Macro for logging a critical-level message.

Definition at line 89 of file Logger.H.

◆ LOG_DEBUG

#define LOG_DEBUG (   msg,
  ... 
)    Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::DEBUG)

Macro for logging a debug-level message.

Definition at line 85 of file Logger.H.

◆ LOG_ERROR

#define LOG_ERROR (   msg,
  ... 
)    Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::ERROR)

Macro for logging an error-level message.

Definition at line 88 of file Logger.H.

◆ LOG_INFO

#define LOG_INFO (   msg,
  ... 
)    Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::INFO)

Macro for logging an info-level message.

Definition at line 86 of file Logger.H.

◆ LOG_MESSAGE

#define LOG_MESSAGE (   msg,
  ... 
)    fmt::print("{}\n", fmt::format(FMT_STRING(msg), ##__VA_ARGS__))

Macro for printing messages to stdout.

All macros use fmt formatting and forward the formatted message to the logger.

Definition at line 90 of file Logger.H.

◆ LOG_WARN

#define LOG_WARN (   msg,
  ... 
)    Logger::getLogger().log(fmt::format(FMT_STRING(msg), ##__VA_ARGS__), Level::WARN)

Macro for logging a warning-level message.

Definition at line 87 of file Logger.H.

Enumeration Type Documentation

◆ Level

enum class Level : uint8_t
strong

Log severity levels.

Supported levels:

  • NOTSET
  • DEBUG
  • INFO
  • WARN
  • ERROR
  • CRITICAL
Enumerator
NOTSET 

No level set.

DEBUG 

Debug messages.

INFO 

Informational messages.

WARN 

Warning conditions.

ERROR 

Error conditions.

CRITICAL 

Critical conditions.

Definition at line 60 of file Logger.H.

60 : uint8_t {
61 NOTSET,
62 DEBUG,
63 INFO,
64 WARN,
65 ERROR,
67};
@ NOTSET
No level set.
@ WARN
Warning conditions.
@ INFO
Informational messages.
@ CRITICAL
Critical conditions.
@ ERROR
Error conditions.
@ DEBUG
Debug messages.