Engine
Raylib based game framework
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Logger Class Reference

Thread safe logging utility with differing levels for both console and file. More...

#include <Logger.h>

Static Public Member Functions

static void SetLogLevel (const LogLevel levelIn)
 Sets minimum log level.
 
static void SetLogFile (const char *path)
 Sets the output file.
 
template<typename... Args>
static void Write (const LogLevel levelIn, Args &&... args)
 Writes a log message.
 

Detailed Description

Thread safe logging utility with differing levels for both console and file.

Member Function Documentation

◆ SetLogFile()

void Logger::SetLogFile ( const char *  path)
static

Sets the output file.

If a file is already opened it is closed.

Parameters
pathPath to log file, empty string disables file output

◆ SetLogLevel()

void Logger::SetLogLevel ( const LogLevel  levelIn)
static

Sets minimum log level.

Parameters
levelInMinimum log level to output

◆ Write()

template<typename... Args>
static void Logger::Write ( const LogLevel  levelIn,
Args &&...  args 
)
inlinestatic

Writes a log message.

Outputs a message to stderr and a file if set, depending if the log level is higher than the set minimum.

Template Parameters
ArgsStrings and other printable
Parameters
levelInMessage log level
argsValues to be printed separated by commas

Usage:

logger.Write(LogLevel::INFO, "Value is: ", number);

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