diff --git a/Logging.md b/Logging.md new file mode 100644 index 0000000..a33f2b8 --- /dev/null +++ b/Logging.md @@ -0,0 +1,52 @@ +### Stone_Red_Utilities.Logging + +#### Constructor + +* Logger + * Description: Initializes the logger with the default format and a file path. + * Parameters: `LogTarget logTarg`, `string file`, `string defaultFormat` + * Example usage: + + ```cs + Logger logger = new Logger(LogTarget.ConsoleAndFile, "events.log", "{:HH:mm:ss} | {,-7} | {,-15} | {}"); + ``` + +#### Methods + +* Log + * Description: Log the message to the specified output + * Parameters: `string message`, `string source`, `LogSeverity logSeverity` + * Example usage: + + ```cs + logger.Log("something happend", "Update manager", LogSeverity.Error); + ``` + + * Output (Depends on the specified log format): + + ```text + 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: + + ```cs + logger.Log(IsValid(),"something is invalid", "Update manager", LogSeverity.Error); + ``` + + * Output (Depends on the specified log format): + + ```text + :15:14 | Error | Update manager | something happend + ``` + +* ClearLogFile + * Description: Clears the log file + * Example usage: + + ```cs + logger.ClearLogFile(); + ``` \ No newline at end of file