Elaztek Developer Hub
Blamite Game Engine - Strings  00390.07.02.23.1947.blamite
A library containing general purpose utilities and classes for use in multiple projects.
BlamStrings::Logger Namespace Reference

Namespace containing functions for the unified logger. More...

Functions

STRINGS_API BlamBasicLoggerGetLogger ()
 Retrieves the unified logger. More...
 
STRINGS_API void PrepareLogger (std::string directory="", std::string file_name="")
 Prepares the logger. More...
 
STRINGS_API void ShutdownLogger ()
 Shuts down the logger. More...
 
STRINGS_API void LogEvent (BlamBasicLogMessage message)
 Logs an event to the logger. More...
 
STRINGS_API void LogEvent (std::string message)
 Logs an event to the logger. More...
 
STRINGS_API void LogEvent (std::string message, BlamLogLevel log_level)
 Logs an event to the logger. More...
 
STRINGS_API void LogEvent (std::string message, TerminalColor color)
 Logs an event to the logger. More...
 
STRINGS_API void AddReceiver (BlamLogReceiver *receiver)
 Registers a receiver which will be notified on new log messages. More...
 
STRINGS_API void RemoveReceiver (BlamLogReceiver *receiver)
 Unregisters a receiver. More...
 
STRINGS_API std::vector< BlamBasicLogMessageGetHistory ()
 Retrieves log history. More...
 
STRINGS_API bool WriteToFile (std::string directory_path="", std::string file_name="log")
 Saves the log history to the specified directory. More...
 

Detailed Description

Namespace containing functions for the unified logger.

This logger is utilized by each and every application, excluding the game engine itself as it has different requirements for its logging system.

Function Documentation

◆ AddReceiver()

void BlamStrings::Logger::AddReceiver ( BlamLogReceiver receiver)

Registers a receiver which will be notified on new log messages.

Parameters
receiver- The new receiver to add.
+ Here is the call graph for this function:

◆ GetHistory()

std::vector< BlamBasicLogMessage > BlamStrings::Logger::GetHistory ( )

Retrieves log history.

Returns
Log history.
+ Here is the call graph for this function:

◆ GetLogger()

BlamBasicLogger * BlamStrings::Logger::GetLogger ( )

Retrieves the unified logger.

Should be used sparingly.

Returns
A pointer to the unified logger.

◆ LogEvent() [1/4]

void BlamStrings::Logger::LogEvent ( BlamBasicLogMessage  message)

Logs an event to the logger.

Parameters
message- The message to log to the console.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogEvent() [2/4]

void BlamStrings::Logger::LogEvent ( std::string  message)

Logs an event to the logger.

Parameters
message- The message to log to the console.
+ Here is the call graph for this function:

◆ LogEvent() [3/4]

void BlamStrings::Logger::LogEvent ( std::string  message,
BlamLogLevel  log_level 
)

Logs an event to the logger.

Parameters
message- The message to log to the console.
log_level- The log level of the message.
+ Here is the call graph for this function:

◆ LogEvent() [4/4]

void BlamStrings::Logger::LogEvent ( std::string  message,
TerminalColor  color 
)

Logs an event to the logger.

Parameters
message- The message to log to the console.
color- The color to use when printing the message to the standard output.
+ Here is the call graph for this function:

◆ PrepareLogger()

void BlamStrings::Logger::PrepareLogger ( std::string  directory = "",
std::string  file_name = "" 
)

Prepares the logger.

If the logger has already been prepared previously, this will have no effect.

The application which is being launched and hooking into the library is responsible for preparing the logger.

+ Here is the caller graph for this function:

◆ RemoveReceiver()

void BlamStrings::Logger::RemoveReceiver ( BlamLogReceiver receiver)

Unregisters a receiver.

This receiver will no longer be notified when new messages are logged.

Parameters
receiver- The receiver to remove.
+ Here is the call graph for this function:

◆ ShutdownLogger()

void BlamStrings::Logger::ShutdownLogger ( )

Shuts down the logger.

If the logger has already been shut down, this has no effect.

The application which is being launched and hooking into the library is responsible for terminating the logger.

+ Here is the call graph for this function:

◆ WriteToFile()

bool BlamStrings::Logger::WriteToFile ( std::string  directory_path = "",
std::string  file_name = "log" 
)

Saves the log history to the specified directory.

Parameters
directory_path- The directory to store the log file in. If left blank, then the default directory is used. If this is left blank AND no directory has been specified, then the log file will not be written and this method will fail.
file_name- The prefix/name for the log file. Defaults to log. This should usually be customized depending on the application which is saving the log file.
Returns
true if the log file was saved successfully, otherwise returns false.
+ Here is the call graph for this function: