 |
Blamite Game Engine - Strings
00429.01.19.25.0114.blamite
A library containing general purpose utilities and classes for use in multiple projects.
|
Go to the documentation of this file.
10 #define STRINGS_API __declspec(dllexport)
12 #define STRINGS_API __declspec(dllimport)
15 #define LOGGER_ID_GUERILLA 1
16 #define LOGGER_ID_KEYSTONE 2
17 #define LOGGER_ID_STRINGS 3
18 #define LOGGER_ID_TOOL 4
19 #define LOGGER_ID_UNIFIED 5
22 #define WSV_NONE BlamLogLevel::None
23 #define WSV_ERROR BlamLogLevel::Error
24 #define WSV_WARNING BlamLogLevel::Warning
25 #define WSV_SEVERE BlamLogLevel::Severe
69 #define WVIS_NONE BlamLogVisibility::None
70 #define WVIS_ALL BlamLogVisibility::All
71 #define WVIS_STDOUT_ONLY BlamLogVisibility::StdoutOnly
72 #define WVIS_FILE_ONLY BlamLogVisibility::FileOnly
73 #define WVIS_HTML_ONLY BlamLogVisibility::HTMLOnly
74 #define WVIS_TXT_ONLY BlamLogVisibility::TXTOnly
144 bool show_timestamp =
true;
146 bool override_color =
false;
151 bool override_duplicate_limit =
false;
163 bool has_custom_color =
false;
164 std::string message =
"";
165 std::string timestamp =
"";
178 std::string GetMessageLine();
215 bool print_to_stdout =
false;
216 std::string log_name =
"";
217 std::string save_directory =
"";
219 std::vector<BlamBasicLogMessage> history = std::vector<BlamBasicLogMessage>();
220 std::vector<BlamLogReceiver*> receivers = std::vector<BlamLogReceiver*>();
245 BlamBasicLogger(
int _unique_id, std::string _save_directory, std::string _log_name);
250 void ClearHistory(std::string _save_directory =
"", std::string _file_name =
"");
257 void SetCommandLinePrintingEnabled(
bool print_to_cmd);
264 std::vector<BlamBasicLogMessage>
GetHistory();
321 bool WriteToFile(std::string directory_path =
"", std::string file_name =
"log");
std::string timestamp
The message timestamp.
Definition: logger.h:165
@ All
The message will be shown in all places where log output can be written.
STRINGS_API void LogEvent(std::string message, TerminalColor color)
Logs an event to the logger.
Definition: logger.cpp:71
Interface used to receive log messages.
Definition: logger.h:193
void RemoveReceiver(BlamLogReceiver *receiver)
Unregisters a receiver from this logger.
Definition: BlamBasicLogger.cpp:133
@ ObjectMaterialsDebug
RESERVED Report file for object-specific material messages.
BlamLogVisibility
Enumerator to specify log event visibility.
Definition: logger.h:79
@ ShadersDebug
BlamReport file for shader messages.
Class represneting a basic log message.
Definition: logger.h:157
BlamBasicLogger()
Initializes a new logger.
Definition: BlamBasicLogger.cpp:7
bool WriteToFile(std::string directory_path="", std::string file_name="log")
Saves the log history to the specified directory.
Definition: BlamBasicLogger.cpp:148
STRINGS_API std::string GenerateLogLevelPrefix(BlamLogLevel log_level)
Generates a prefix for a given log level, such as [INFO] or [WARN].
Definition: logger.cpp:7
BlamBasicLogger * unified_logger
Definition: logger.cpp:3
std::vector< BlamBasicLogMessage > GetHistory()
Retrieves the log history.
Definition: BlamBasicLogger.cpp:54
STRINGS_API void AddReceiver(BlamLogReceiver *receiver)
Registers a receiver which will be notified on new log messages.
Definition: logger.cpp:81
virtual void LogMessageReceived(BlamBasicLogMessage message)
Called whenever a log message is received.
Definition: logger.h:201
#define LOGGER_ID_UNIFIED
Definition: logger.h:19
STRINGS_API std::string GetDateTime(const char *format)
Retrieves the current date/time in the specified format.
Definition: datetime.cpp:13
STRINGS_API void LogEvent(BlamBasicLogMessage message)
Logs an event to the logger.
Definition: logger.cpp:41
STRINGS_API void ShutdownLogger()
Shuts down the logger.
Definition: logger.cpp:30
bool Equals(BlamBasicLogMessage other_message)
Checks if the log message is equivalent to another log message.
Definition: BlamBasicLogMessage.cpp:10
@ LocalizationDebug
RESERVED Report file for string and localization debug messages.
@ HSLog
Report file for script-related messages.
#define STRINGS_API
Definition: logger.h:12
@ NetworkingDebug
RESERVED Report file for networking debug messages.
BlamColor color
The overridden color information. Overrules any severity-based coloring.
Definition: logger.h:147
std::string message
The message contents.
Definition: logger.h:142
BlamBasicLogger * logger
The logger that the message originated from.
Definition: logger.h:160
@ FileOnly
The message will only be written to the log file.
void ClearHistory(std::string _save_directory="", std::string _file_name="")
Clears all log history.
Definition: BlamBasicLogger.cpp:28
@ MultiplayerDebug
RESERVED Report file for multiplayer game debug.
STRINGS_API BlamBasicLogger * GetLogger()
Retrieves the unified logger.
Definition: logger.cpp:5
@ AnimationAudioContentDebug
RESERVED
STRINGS_API bool CreateNewFile(std::string filename, std::string file_contents)
Creates a file with the specified contents, or overwrites an existing file if it already exists.
Definition: io.cpp:75
#define WVIS_ALL
Macro for 'All' log visibility. Original pre-enum value was 0.
Definition: logger.h:70
@ HTMLOnly
The message will only be written to the log file, if the file is in HTML format.
std::string GetMessageLine()
Generates a formatted message, ready to be written to any output or log.
Definition: BlamBasicLogMessage.cpp:5
@ ObjectsDebug
RESERVED Report file for game object debug messages.
@ UIDebug
BlamReport file for all UI messages.
@ TXTOnly
The message will only be written to the log file, if the file is in plain text format.
STRINGS_API TerminalColor TranslateLogLevelAsColor(BlamLogLevel log_level)
Translates a given BlamLogLevel into the appropriate terminal color.
Definition: logger.cpp:29
STRINGS_API void RemoveReceiver(BlamLogReceiver *receiver)
Unregisters a receiver.
Definition: logger.cpp:91
BlamLogLevel log_level
The message log level.
Definition: logger.h:161
BlamReportType
Enumerator containing possible report types.
Definition: logger.h:100
STRINGS_API std::string GetTimeLogFormat()
Retrieves the current date/time in the following format, for use in the logger: MM....
Definition: datetime.cpp:29
@ DebugFull
Similar to debug, but includes additional messages that are typically hidden from debug.
@ Error
Indicates an error that could cause engine instability.
@ SoundDebug
RESERVED Report file for sound/audio-related debug messages.
@ None
Indicates no severity, and is displayed with no formatting.
STRINGS_API std::string NormalizePath(std::string path)
Normalizes a path string.
Definition: io.cpp:297
@ LeaderboardDebug
RESERVED Report file for leaderboard debug messages. GAME-SPECIFIC
void AddReceiver(BlamLogReceiver *receiver)
Registers a receiver to this logger.
Definition: BlamBasicLogger.cpp:125
STRINGS_API bool FileExists(std::string name)
Checks if the specified file or directory exists.
Definition: io.cpp:25
void LogEvent(BlamBasicLogMessage message)
Writes a message to the log.
Definition: BlamBasicLogger.cpp:59
STRINGS_API bool WriteToFile(std::string directory_path="", std::string file_name="log")
Saves the log history to the specified directory.
Definition: logger.cpp:111
std::string message
The message content.
Definition: logger.h:164
@ EnvironmentDebug
RESERVED
@ TagDebug
BlamReport file for all tag related messages.
@ DesignDebug
RESERVED Report file for level design debug.
STRINGS_API void ValidatePath(std::string path)
Validates that the specified path exists.
Definition: io.cpp:93
STRINGS_API void PrepareLogger(std::string directory="", std::string file_name="")
Prepares the logger.
Definition: logger.cpp:10
std::basic_string< CharT, Traits, Allocator > to_string(uuid const &id)
Definition: uuid.h:581
@ AnimationDebug
RESERVED Report file for animation debug messages.
@ Severe
Indicates a severe error that the engine cannot recover from.
@ Debug
Default report file. Contains all log messages found in other reports, excluding debug_full.
#define WSV_NONE
Macro for 'None' log seveirty.
Definition: logger.h:22
@ PlayerRewardsDebug
RESERVED Report file for player reward debug messages. GAME-SPECIFIC
Structure to store log message data.
Definition: logger.h:137
Namespace containing functions related to the logger.
Definition: logger.h:327
STRINGS_API std::vector< BlamBasicLogMessage > GetHistory()
Retrieves log history.
Definition: logger.cpp:101
bool has_custom_color
Whether or not the message has a custom terminal color set.
Definition: logger.h:163
std::string timestamp
The timestamp of the log message.
Definition: logger.h:141
TerminalColor
Enumerator listing all possible terminal colors.
Definition: logger.h:35
@ AIDebug
RESERVED Report file for AI debug messages.
@ StdoutOnly
The message will only be shown to the in-game console and STDOUT.
Class representing a color.
Definition: BlamColor.h:19
Class representing a basic logger.
Definition: logger.h:212
BlamLogLevel
Enumerator to specify log event severity.
Definition: logger.h:60
TerminalColor color
The custom color to assign to the message when printing to stdout.
Definition: logger.h:162
@ StreamManagerDebug
RESERVED
void SetCommandLinePrintingEnabled(bool print_to_cmd)
Sets whether or not log messages should be written to the standard output.
Definition: BlamBasicLogger.cpp:49
@ Warning
Indicates a warning message. Not something critical, but something that could cause unexpected behavi...
@ OgreDebug
BlamReport file for OGRE log messages.
@ GeometryDebug
RESERVED Report file for geometry-related messages.
@ EnvironmentMaterialsDebug
RESERVED Report file for environment-specific material messages.
STRINGS_API void PrintMessageToStdout(std::string message, TerminalColor color)
Prints a message to the standard output.
Definition: logger.cpp:49