Kale
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Kale::Logger Class Reference

#include <Logger.hpp>

Public Member Functions

 Logger ()
 
 Logger (const Logger &other)=delete
 
 Logger (Logger &&other)=delete
 
void operator= (const Logger &other)=delete
 
void operator= (Logger &&other)=delete
 
template<typename T >
void log (T msg)
 
template<typename T >
void info (T msg)
 
template<typename T >
void warn (T msg)
 
template<typename T >
void error (T msg)
 
template<typename T >
void log (unsigned int line, const char *file, T msg)
 
template<typename T >
void info (unsigned int line, const char *file, T msg)
 
template<typename T >
void warn (unsigned int line, const char *file, T msg)
 
template<typename T >
void error (unsigned int line, const char *file, T msg)
 
template<typename T >
void assertCheck (unsigned int line, const char *file, T assertion)
 
template<typename T , typename STR >
void assertCheck (unsigned int line, const char *file, T assertion, STR msg)
 

Protected Member Functions

void load (const std::string &applicationName)
 

Private Member Functions

std::string getTimePrefix ()
 

Private Attributes

std::ofstream logFile
 
std::mutex mutex
 

Friends

class Application
 

Detailed Description

The main logger class for the game

Definition at line 40 of file Logger.hpp.

Constructor & Destructor Documentation

◆ Logger() [1/3]

Logger::Logger ( )

Creates the logger object, this will not be initialized until load is called

Definition at line 41 of file Logger.cpp.

◆ Logger() [2/3]

Kale::Logger::Logger ( const Logger & other)
delete

Logger does not support copying/moving

◆ Logger() [3/3]

Kale::Logger::Logger ( Logger && other)
delete

Logger does not support copying/moving

Member Function Documentation

◆ assertCheck() [1/2]

template<typename T >
void Kale::Logger::assertCheck ( unsigned int line,
const char * file,
T assertion )
inline

Logs an assertion to the console

Parameters
lineThe line number the log is being called from
fileThe name of the file the log is being called from
assertionThe message to log

Definition at line 295 of file Logger.hpp.

◆ assertCheck() [2/2]

template<typename T , typename STR >
void Kale::Logger::assertCheck ( unsigned int line,
const char * file,
T assertion,
STR msg )
inline

Logs an assertion to the console

Parameters
lineThe line number the log is being called from
fileThe name of the file the log is being called from
assertionThe assertion to check
msgThe message to log if the assertion fails

Definition at line 307 of file Logger.hpp.

◆ error() [1/2]

template<typename T >
void Kale::Logger::error ( T msg)
inline

Logs an error to the console

Parameters
msgThe message to log

Definition at line 198 of file Logger.hpp.

◆ error() [2/2]

template<typename T >
void Kale::Logger::error ( unsigned int line,
const char * file,
T msg )
inline

Logs an error to the console

Parameters
lineThe line number the log is being called from
fileThe name of the file the log is being called from
msgThe message to log

Definition at line 275 of file Logger.hpp.

◆ getTimePrefix()

std::string Logger::getTimePrefix ( )
private

Gets the time prefix for logging

Returns
The time prefix

Gets the time prefix for logging

Returns
the time prefix

Definition at line 90 of file Logger.cpp.

◆ info() [1/2]

template<typename T >
void Kale::Logger::info ( T msg)
inline

Logs info to the console

Parameters
msgThe message to log

Definition at line 166 of file Logger.hpp.

◆ info() [2/2]

template<typename T >
void Kale::Logger::info ( unsigned int line,
const char * file,
T msg )
inline

Logs info to the console

Parameters
lineThe line number the log is being called from
fileThe name of the file the log is being called from
msgThe message to log

Definition at line 235 of file Logger.hpp.

◆ load()

void Logger::load ( const std::string & applicationName)
protected

Loads and sets up the console

Parameters
applicationNameThe name of the application

Definition at line 52 of file Logger.cpp.

◆ log() [1/2]

template<typename T >
void Kale::Logger::log ( T msg)
inline

Logs output to the console

Parameters
msgThe message to log

Definition at line 150 of file Logger.hpp.

◆ log() [2/2]

template<typename T >
void Kale::Logger::log ( unsigned int line,
const char * file,
T msg )
inline

Logs output to the console

Parameters
lineThe line number the log is being called from
fileThe name of the file the log is being called from
msgThe message to log

Definition at line 216 of file Logger.hpp.

◆ operator=() [1/2]

void Kale::Logger::operator= ( const Logger & other)
delete

Logger does not support copying/moving

◆ operator=() [2/2]

void Kale::Logger::operator= ( Logger && other)
delete

Logger does not support copying/moving

◆ warn() [1/2]

template<typename T >
void Kale::Logger::warn ( T msg)
inline

Logs a warning to the console

Parameters
msgThe message to log

Definition at line 182 of file Logger.hpp.

◆ warn() [2/2]

template<typename T >
void Kale::Logger::warn ( unsigned int line,
const char * file,
T msg )
inline

Logs a warning to the console

Parameters
lineThe line number the log is being called from
fileThe name of the file the log is being called from
msgThe message to log

Definition at line 255 of file Logger.hpp.

Friends And Related Symbol Documentation

◆ Application

friend class Application
friend

Definition at line 117 of file Logger.hpp.

Member Data Documentation

◆ logFile

std::ofstream Kale::Logger::logFile
private

The main log file for logging output to

Definition at line 96 of file Logger.hpp.

◆ mutex

std::mutex Kale::Logger::mutex
private

The mutex used for keeping the log file thread safe

Definition at line 101 of file Logger.hpp.


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