Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::log::Config Struct Reference

Configuration for logger behavior and output. More...

#include <config.hpp>

Static Public Member Functions

static constexpr Config Default () noexcept
 Creates default configuration.
static constexpr Config ConsoleOnly () noexcept
 Creates configuration for console-only output.
static constexpr Config FileOnly () noexcept
 Creates configuration for file-only output.
static constexpr Config Debug () noexcept
 Creates configuration optimized for debug builds.
static constexpr Config Release () noexcept
 Creates configuration optimized for release builds.

Public Attributes

std::string_view log_directory = "logs"
 Log output directory path.
std::string_view file_name_pattern
std::string_view console_pattern
 Console log pattern.
std::string_view file_pattern
 File log pattern.
size_t max_file_size
 Maximum size of a single log file in bytes (0 = no limit).
size_t max_files
 Maximum number of log files to keep (0 = no limit).
Level auto_flush_level
 Minimum log level to flush automatically.
bool enable_console = true
 Enable console output.
bool enable_file = true
 Enable file output.
bool truncate_files = true
 Enable truncation of existing log files.
bool async_logging = false
size_t async_queue_size
 Queue size for async logging (only used when async_logging).
size_t async_thread_count
 Background thread count for async logging.

Detailed Description

Configuration for logger behavior and output.

Definition at line 24 of file config.hpp.

Member Function Documentation

◆ ConsoleOnly()

constexpr Config helios::log::Config::ConsoleOnly ( )
inlinestaticnodiscardconstexprnoexcept

Creates configuration for console-only output.

Returns
Config instance for console-only logging

Definition at line 61 of file config.hpp.

◆ Debug()

constexpr Config helios::log::Config::Debug ( )
inlinestaticnodiscardconstexprnoexcept

Creates configuration optimized for debug builds.

Returns
Config instance for debug logging

Definition at line 77 of file config.hpp.

◆ Default()

constexpr Config helios::log::Config::Default ( )
inlinestaticnodiscardconstexprnoexcept

Creates default configuration.

Returns
Default Config instance

Definition at line 55 of file config.hpp.

◆ FileOnly()

constexpr Config helios::log::Config::FileOnly ( )
inlinestaticnodiscardconstexprnoexcept

Creates configuration for file-only output.

Returns
Config instance for file-only logging

Definition at line 69 of file config.hpp.

◆ Release()

constexpr Config helios::log::Config::Release ( )
inlinestaticnodiscardconstexprnoexcept

Creates configuration optimized for release builds.

Returns
Config instance for release logging

Definition at line 88 of file config.hpp.

Member Data Documentation

◆ async_logging

bool helios::log::Config::async_logging = false

Enable async logging (better performance but may lose last logs on crash).

Definition at line 44 of file config.hpp.

◆ async_queue_size

size_t helios::log::Config::async_queue_size
Initial value:
=
8192

Queue size for async logging (only used when async_logging).

Definition at line 46 of file config.hpp.

◆ async_thread_count

size_t helios::log::Config::async_thread_count
Initial value:
=
1

Background thread count for async logging.

Definition at line 48 of file config.hpp.

◆ auto_flush_level

Level helios::log::Config::auto_flush_level
Initial value:

Minimum log level to flush automatically.

Definition at line 38 of file config.hpp.

◆ console_pattern

std::string_view helios::log::Config::console_pattern
Initial value:
=
"[%H:%M:%S.%e] [%t] [%^%l%$] %n: %v"

Console log pattern.

Definition at line 29 of file config.hpp.

◆ enable_console

bool helios::log::Config::enable_console = true

Enable console output.

Definition at line 41 of file config.hpp.

◆ enable_file

bool helios::log::Config::enable_file = true

Enable file output.

Definition at line 42 of file config.hpp.

◆ file_name_pattern

std::string_view helios::log::Config::file_name_pattern
Initial value:
=
"{name}_{timestamp}.log"

Pattern for log file names (supports format placeholders: {name}, {timestamp}).

Definition at line 26 of file config.hpp.

◆ file_pattern

std::string_view helios::log::Config::file_pattern
Initial value:
=
"[%Y-%m-%d %H:%M:%S.%e] [%t] [%l] %n: %v"

File log pattern.

Definition at line 31 of file config.hpp.

◆ log_directory

std::string_view helios::log::Config::log_directory = "logs"

Log output directory path.

Definition at line 25 of file config.hpp.

◆ max_file_size

size_t helios::log::Config::max_file_size
Initial value:
=
0

Maximum size of a single log file in bytes (0 = no limit).

Definition at line 34 of file config.hpp.

◆ max_files

size_t helios::log::Config::max_files
Initial value:
=
0

Maximum number of log files to keep (0 = no limit).

Definition at line 36 of file config.hpp.

◆ truncate_files

bool helios::log::Config::truncate_files = true

Enable truncation of existing log files.

Definition at line 43 of file config.hpp.