Webserv
Loading...
Searching...
No Matches
Logger.hpp File Reference
#include <string>
#include <sstream>

Go to the source code of this file.

Classes

class  utils::Logger

Namespaces

namespace  utils

Macros

#define LOG_MSG(level, msg)
 The base macro for logging. It constructs a string from the stream-like input and passes it to the core logging function.
#define LOG_TRACE(msg)
 Logs a message with the TRACE severity level.
#define LOG_DEBUG(msg)
 Logs a message with the DEBUG severity level.
#define LOG_INFO(msg)
 Logs a message with the INFO severity level.
#define LOG_WARN(msg)
 Logs a message with the WARNING severity level.
#define LOG_ERROR(msg)
 Logs a message with the ERROR severity level.
#define LOG_FATAL(msg)
 Logs a message with the FATAL severity level.

Enumerations

enum  utils::LogLevel {
  utils::TRACE , utils::DEBUG , utils::INFO , utils::WARNING ,
  utils::ERROR , utils::FATAL
}
 Defines the severity levels for log messages. More...

Macro Definition Documentation

◆ LOG_DEBUG

#define LOG_DEBUG ( msg)
Value:
#define LOG_MSG(level, msg)
The base macro for logging. It constructs a string from the stream-like input and passes it to the co...
Definition Logger.hpp:37
@ DEBUG
Information useful for developers during debugging.
Definition Logger.hpp:14

Logs a message with the DEBUG severity level.

Use for information useful during development and debugging.

◆ LOG_ERROR

#define LOG_ERROR ( msg)
Value:
@ ERROR
An error that occurred but the application can recover from.
Definition Logger.hpp:17

Logs a message with the ERROR severity level.

Use for errors that the application can recover from.

◆ LOG_FATAL

#define LOG_FATAL ( msg)
Value:
@ FATAL
A critical error that will likely lead to termination.
Definition Logger.hpp:18

Logs a message with the FATAL severity level.

Use for critical errors that prevent the application from continuing.

◆ LOG_INFO

#define LOG_INFO ( msg)
Value:
@ INFO
Informational messages about application progress.
Definition Logger.hpp:15

Logs a message with the INFO severity level.

Use for general application progress and lifecycle events.

◆ LOG_MSG

#define LOG_MSG ( level,
msg )
Value:
{ \
std::ostringstream oss; \
oss << msg; \
utils::Logger::log(level, oss.str()); \
}

The base macro for logging. It constructs a string from the stream-like input and passes it to the core logging function.

Parameters
levelThe utils::LogLevel for the message.
msgA streamable expression (e.g., "User ID: " << id).

◆ LOG_TRACE

#define LOG_TRACE ( msg)
Value:
@ TRACE
Fine-grained messages, typically for detailed debugging.
Definition Logger.hpp:13

Logs a message with the TRACE severity level.

Use for highly detailed, step-by-step execution flow.

◆ LOG_WARN

#define LOG_WARN ( msg)
Value:
@ WARNING
Indicates a potential issue that is not a critical error.
Definition Logger.hpp:16

Logs a message with the WARNING severity level.

Use for potential problems that do not stop program execution.