Created Logging (markdown)

Stone_Red
2021-05-10 17:38:49 +02:00
parent f76b68fcb4
commit a405d92306
+52
@@ -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", "{<dateTime>:HH:mm:ss} | {<level>,-7} | {<source>,-15} | {<message>}");
```
#### 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();
```