mirror of
https://github.com/Ellpeck/ExtremelySimpleLogger.git
synced 2024-11-22 01:53:29 +01:00
readme info and nuget spec
This commit is contained in:
parent
2ab19a2e5d
commit
982e678ebb
3 changed files with 41 additions and 1 deletions
|
@ -5,4 +5,13 @@
|
|||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Authors>Ellpeck</Authors>
|
||||
<Description>A very simple logger for .NET programs</Description>
|
||||
<PackageTags>logging logger utility debug trace output file</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/Ellpeck/ExtremelySimpleLogger</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/Ellpeck/ExtremelySimpleLogger</RepositoryUrl>
|
||||
<PackageLicenseUrl>https://github.com/Ellpeck/ExtremelySimpleLogger/blob/master/LICENSE</PackageLicenseUrl>
|
||||
<VersionPrefix>1.0.0</VersionPrefix>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
31
README.md
Normal file
31
README.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# ExtremelySimpleLogger
|
||||
**A very simple logger for .NET programs.**
|
||||
|
||||
To set up an extremely simple logger, you have to create an instance of the `Logger` class:
|
||||
```cs
|
||||
var logger = new Logger {
|
||||
Name = "My Logger",
|
||||
Sinks = {
|
||||
new FileSink("Log.txt", append: true),
|
||||
new ConsoleSink()
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
Since there are multiple ways for logging data to be processed, the logger needs to receive a set of `Sink` instances. By default, the following sinks are available:
|
||||
- `FileSink`, which outputs logging data to a file
|
||||
- `ConsoleSink`, which outputs logging data to the default console
|
||||
|
||||
There are multiple ways to easily log messages with your newly created logger:
|
||||
```cs
|
||||
// Logging info
|
||||
logger.Log(LogLevel.Info, "Some information");
|
||||
logger.Info("Some information, but shorter");
|
||||
|
||||
// Logging exceptions
|
||||
try {
|
||||
// some dangerous code
|
||||
} catch (Exception e) {
|
||||
logger.Error("An exception was thrown", e);
|
||||
}
|
||||
```
|
|
@ -7,7 +7,7 @@ namespace Sample {
|
|||
|
||||
private static void Main() {
|
||||
var logger = new Logger {
|
||||
Name = "Test Logger",
|
||||
Name = "Example Logger",
|
||||
Sinks = {
|
||||
new FileSink("Log.txt", true) {MinimumLevel = LogLevel.Trace},
|
||||
new ConsoleSink()
|
||||
|
|
Loading…
Reference in a new issue