![]() |
Blamite Game Engine - Strings
00390.07.02.23.1947.blamite
A library containing general purpose utilities and classes for use in multiple projects.
|
Namespace containing functions for the unified logger. More...
Functions | |
STRINGS_API BlamBasicLogger * | GetLogger () |
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< BlamBasicLogMessage > | GetHistory () |
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... | |
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.
void BlamStrings::Logger::AddReceiver | ( | BlamLogReceiver * | receiver | ) |
Registers a receiver which will be notified on new log messages.
receiver | - The new receiver to add. |
std::vector< BlamBasicLogMessage > BlamStrings::Logger::GetHistory | ( | ) |
Retrieves log history.
BlamBasicLogger * BlamStrings::Logger::GetLogger | ( | ) |
Retrieves the unified logger.
Should be used sparingly.
void BlamStrings::Logger::LogEvent | ( | BlamBasicLogMessage | message | ) |
Logs an event to the logger.
message | - The message to log to the console. |
void BlamStrings::Logger::LogEvent | ( | std::string | message | ) |
Logs an event to the logger.
message | - The message to log to the console. |
void BlamStrings::Logger::LogEvent | ( | std::string | message, |
BlamLogLevel | log_level | ||
) |
Logs an event to the logger.
message | - The message to log to the console. |
log_level | - The log level of the message. |
void BlamStrings::Logger::LogEvent | ( | std::string | message, |
TerminalColor | color | ||
) |
Logs an event to the logger.
message | - The message to log to the console. |
color | - The color to use when printing the message to the standard output. |
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.
void BlamStrings::Logger::RemoveReceiver | ( | BlamLogReceiver * | receiver | ) |
Unregisters a receiver.
This receiver will no longer be notified when new messages are logged.
receiver | - The receiver to remove. |
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.
bool BlamStrings::Logger::WriteToFile | ( | std::string | directory_path = "" , |
std::string | file_name = "log" |
||
) |
Saves the log history to the specified directory.
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. |
true
if the log file was saved successfully, otherwise returns false
.