Added Logger Control Functions.

This commit is contained in:
2025-01-27 00:55:03 -05:00
parent 9720f82315
commit b24f1e9039
2 changed files with 113 additions and 1 deletions

View File

@@ -18,6 +18,20 @@ namespace CaveGame::Logs
extern Logger Server;
extern Logger Generator;
extern Logger Lighting;
extern Logger Network;
void SetAllEnableConsole(bool log_to_console);
void SetAllEnableFile(bool log_to_file);
void EnableAllToConsole();
void EnableAllToFile();
void DisableAllToConsole();
void DisableAllToFile();
void EnableAll();
void DisableAll();
void SetIncludeSourceLocationAll(bool inc_location);
void SetIncludeTimestampAll(bool inc_timestamp);
void EnableSourceLocationAll();
void DisableSourceLocationAll();
void EnableTimestampAll();
void DisableTimestampAll();
}

View File

@@ -8,9 +8,107 @@ namespace CaveGame::Logs {
GenericLogger Debug {"CaveGame", GlobalLogFile,Colors::Greens::Lime, Colors::Gray, Colors::Gray, Colors::Gray};
GenericLogger Warning {"CaveGame", GlobalLogFile,Colors::Oranges::Gold, Colors::Gray, Colors::Gray, Colors::Gray};
GenericLogger Error {"CaveGame", GlobalLogFile,Colors::Reds::Salmon, Colors::Gray, Colors::Gray, Colors::Gray};
GenericLogger Fatal {"CaveGame", GlobalLogFile, Colors::Reds::DarkRed, Colors::Reds::DarkRed, Colors::Reds::DarkRed, Colors::Reds::DarkRed};
GenericLogger Client {"CaveGame::Client", GlobalLogFile,Colors::Greens::Lime, Colors::Gray, Colors::Gray, Colors::Gray};
GenericLogger Server {"CaveGame::Server", GlobalLogFile,Colors::Greens::Lime, Colors::Gray, Colors::Gray, Colors::Gray};
GenericLogger Generator {"CaveGame::Generator", GlobalLogFile,Colors::Greens::Lime, Colors::Gray, Colors::Gray, Colors::Gray};
GenericLogger Lighting {"CaveGame::Generator", GlobalLogFile,Colors::Greens::Lime, Colors::Gray, Colors::Gray, Colors::Gray};
void SetAllEnableConsole(bool log_to_console) {
Info.EnableConsole(log_to_console);
Debug.EnableConsole(log_to_console);
Warning.EnableConsole(log_to_console);
Error.EnableConsole(log_to_console);
Fatal.EnableConsole(log_to_console);
Client.EnableConsole(log_to_console);
Server.EnableConsole(log_to_console);
Generator.EnableConsole(log_to_console);
Lighting.EnableConsole(log_to_console);
}
void SetAllEnableFile(bool log_to_file) {
Info.EnableFile(log_to_file);
Debug.EnableFile(log_to_file);
Warning.EnableFile(log_to_file);
Error.EnableFile(log_to_file);
Fatal.EnableFile(log_to_file);
Client.EnableFile(log_to_file);
Server.EnableFile(log_to_file);
Generator.EnableFile(log_to_file);
Lighting.EnableFile(log_to_file);
}
void EnableAllToConsole() {
SetAllEnableConsole(true);
}
void EnableAllToFile() {
SetAllEnableFile(true);
}
void DisableAllToConsole() {
SetAllEnableConsole(false);
}
void DisableAllToFile() {
SetAllEnableFile(false);
}
void EnableAll() {
EnableAllToConsole();
EnableAllToFile();
}
void DisableAll() {
DisableAllToConsole();
DisableAllToFile();
}
void SetIncludeSourceLocationAll(bool inc_location) {
Info.IncludeLocation(inc_location);
Debug.IncludeLocation(inc_location);
Warning.IncludeLocation(inc_location);
Error.IncludeLocation(inc_location);
Fatal.IncludeLocation(inc_location);
Client.IncludeLocation(inc_location);
Server.IncludeLocation(inc_location);
Generator.IncludeLocation(inc_location);
Lighting.IncludeLocation(inc_location);
}
void SetIncludeTimestampAll(bool inc_timestamp) {
Info.IncludeTimestamp(inc_timestamp);
Debug.IncludeTimestamp(inc_timestamp);
Warning.IncludeTimestamp(inc_timestamp);
Error.IncludeTimestamp(inc_timestamp);
Fatal.IncludeTimestamp(inc_timestamp);
Client.IncludeTimestamp(inc_timestamp);
Server.IncludeTimestamp(inc_timestamp);
Generator.IncludeTimestamp(inc_timestamp);
Lighting.IncludeTimestamp(inc_timestamp);
}
void EnableSourceLocationAll() {
SetIncludeSourceLocationAll(true);
}
void DisableSourceLocationAll() {
SetIncludeSourceLocationAll(false);
}
void EnableTimestampAll() {
SetIncludeTimestampAll(true);
}
void DisableTimestampAll() {
SetIncludeTimestampAll(false);
}
GenericLogger Network {"CaveGame::Generator", GlobalLogFile,Colors::Greens::Lime, Colors::Gray, Colors::Gray, Colors::Gray};
}