Logger is a diagnostic logging class. It is easy to set up and has a clean API, Logger can write reports both in the Debug and in the text file.
Logger Located in the HandyControl.Tools namespace.
1 | Using HandyControl.Tools; |
You can use the following using
and use the methods without writing the class name
1 | using static HandyControl.Tools.Logger; |
You can use the DefaultInitialization
which includes FileLoggerHandler
and DebugLoggerHandler
or you can choose the handler you want
FileLoggerHandler means that Logs are stored in a text file
DebugLoggerHandler means that Logs are displayed in Visual Studio Output Section
Initialize
1 |
|
Default Level
Settings of default type of message
1 | Logger.DefaultLevel = Logger.Level.Severe; |
Log
1 | // Fast logging (monitor name of class and methods from which is the application logged) |
On/Off
The following methods help to disable or enable logging
Name | Remark |
---|---|
On | Log |
Off | Log |
1 | // Log |