Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
log.hpp File Reference

Thread-safe logger with levels, console and optional file output. More...

#include <aegis2d/core/export.hpp>
#include <atomic>
#include <cstdint>
#include <filesystem>
#include <format>
#include <fstream>
#include <mutex>
#include <string_view>
#include <utility>

Go to the source code of this file.

Classes

class  aegis2d::core::Logger
 Writes timestamped messages to the console (std::clog) and to an optional file. More...
 

Namespaces

namespace  aegis2d
 Root namespace of the engine.
 
namespace  aegis2d::core
 Logging, time, main loop, events and configuration shared by client and server.
 

Enumerations

enum class  aegis2d::core::LogLevel : std::uint8_t {
  aegis2d::core::Debug , aegis2d::core::Info , aegis2d::core::Warn , aegis2d::core::Error ,
  aegis2d::core::Off
}
 Severity of a log message, from the most verbose to the most severe. More...
 

Functions

std::string_view aegis2d::core::to_string (LogLevel level) noexcept
 Short upper-case name of a level.
 
template<typename... Args>
void aegis2d::core::log_debug (std::format_string< Args... > format, Args &&... args)
 Logs a Debug message with the global logger.
 
template<typename... Args>
void aegis2d::core::log_info (std::format_string< Args... > format, Args &&... args)
 Logs an Info message with the global logger.
 
template<typename... Args>
void aegis2d::core::log_warn (std::format_string< Args... > format, Args &&... args)
 Logs a Warn message with the global logger.
 
template<typename... Args>
void aegis2d::core::log_error (std::format_string< Args... > format, Args &&... args)
 Logs an Error message with the global logger.
 

Detailed Description

Thread-safe logger with levels, console and optional file output.