Brenta Engine 1.0
Loading...
Searching...
No Matches
Brenta::Utils::Logger Class Reference

Logger class. More...

#include <engine_logger.hpp>

Static Public Member Functions

static void Init ()
 Initialize the logger.
 
static void SetLogLevel (Brenta::Types::LogLevel level)
 Set the log level.
 
static void SetLogFile (const std::string &file)
 Set the log file.
 
static void Close ()
 Close the logger.
 
template<typename T , typename... Args>
static void LogToStdout (T message, Args... args)
 Log a message to stdout.
 
template<typename T , typename... Args>
static void LogToFile (T message, Args... args)
 Log a message to the log file.
 
template<typename... Args>
static void Log (Brenta::Types::LogLevel level, Args... args)
 Log a message.
 

Static Public Attributes

static Brenta::Types::LogLevel level = Brenta::Types::LogLevel::WARNING
 Log level.
 
static std::ofstream log_file
 Log file.
 

Detailed Description

Logger class.

This class is used to log messages to the console and to a log file. The log messages can be filtered by log level.

Definition at line 56 of file engine_logger.hpp.

Member Function Documentation

◆ Close()

void Logger::Close ( )
static

Close the logger.

This method closes the logger. It should be called before the program exits.

Definition at line 48 of file engine_logger.cpp.

◆ Init()

void Logger::Init ( )
static

Initialize the logger.

This method initializes the logger. It should be called before any other method of the logger is called.

Definition at line 43 of file engine_logger.cpp.

◆ Log()

template<typename... Args>
static void Brenta::Utils::Logger::Log ( Brenta::Types::LogLevel level,
Args... args )
inlinestatic

Log a message.

This method logs a message with the given log level. The message can be any number of arguments of any type. The message is printed to the console and to the log file if the log file is open.

Parameters
levelThe log level
argsThe message

Definition at line 153 of file engine_logger.hpp.

◆ LogToFile()

template<typename T , typename... Args>
static void Brenta::Utils::Logger::LogToFile ( T message,
Args... args )
inlinestatic

Log a message to the log file.

This method logs a message with the given log level. The message can be any number of arguments of any type. The message is printed to the log file if the log file is open.

Parameters
levelThe log level
argsThe message

Definition at line 137 of file engine_logger.hpp.

◆ LogToStdout()

template<typename T , typename... Args>
static void Brenta::Utils::Logger::LogToStdout ( T message,
Args... args )
inlinestatic

Log a message to stdout.

This method logs a message on stdout with the given log level. The message can be any number of arguments of any type.

Parameters
levelThe log level
argsThe message

Definition at line 120 of file engine_logger.hpp.

◆ SetLogFile()

void Logger::SetLogFile ( const std::string & file)
static

Set the log file.

This method sets the log file. The log file is used to store the messages that are printed to the console. The log file can be set to a file name.

Parameters
fileThe log file

Definition at line 53 of file engine_logger.cpp.

◆ SetLogLevel()

void Logger::SetLogLevel ( Brenta::Types::LogLevel level)
static

Set the log level.

This method sets the log level. The log level is used to filter the messages that are printed to the console and to the log file. The log level can be set to DEBUG, INFO, WARNING, ERROR, or DISABLED.

Parameters
levelThe log level

Definition at line 38 of file engine_logger.cpp.

Field Documentation

◆ level

Brenta::Types::LogLevel Logger::level = Brenta::Types::LogLevel::WARNING
static

Log level.

The log level is used to filter the messages that are printed to the console and to the log file. The log level can be set using the SetLogLevel method. Onlt the messages with a Loglevel greater or equal to the set log level are printed.

Definition at line 67 of file engine_logger.hpp.

◆ log_file

std::ofstream Logger::log_file
static

Log file.

The log file is used to store the messages that are printed to the console. The log file can be set using the SetLogFile method.

Definition at line 74 of file engine_logger.hpp.


The documentation for this class was generated from the following files: