This repository was archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Logging
Stone_Red edited this page May 11, 2021
·
5 revisions
- Logger
-
Description: Initializes the logger with the default format and a file path.
-
Parameters:
LogTarget logTarg,string file,string defaultFormat -
Example usage:
Logger logger = new Logger(LogTarget.ConsoleAndFile, "events.log", "{<dateTime>:HH:mm:ss} | {<level>,-7} | {<source>,-15} | {<message>}");
-
-
Log
-
Description: Log the message to the specified output
-
Parameters:
string message,string source,LogSeverity logSeverity -
Example usage:
logger.Log("something happend", "Update manager", LogSeverity.Error);
-
Output (Depends on the specified log format):
19:15:14 | Error | Update manager | something happend
-
-
LogIf
-
Description: Log the message to the specified output if the condition is met
-
Parameters:
bool condition,string message,string source,LogSeverity logSeverity -
Example usage:
logger.Log(IsValid(),"something is invalid", "Update manager", LogSeverity.Error);
-
Output (Depends on the specified log format):
12:15:14 | Error | Update manager | something happend
-
-
ClearLogFile
-
Description: Clears the log file
-
Example usage:
logger.ClearLogFile();
-