A very simple logger for .NET programs
Find a file
2022-10-05 18:13:29 +02:00
.github Create FUNDING.yml 2021-11-08 15:52:55 +01:00
ExtremelySimpleLogger made it easier to change the default log formatter 2022-10-05 18:13:29 +02:00
Sample expose some more information in file, console and directory sinks 2022-01-17 12:49:50 +01:00
.gitignore Initial commit 2020-07-23 02:24:18 +02:00
ExtremelySimpleLogger.sln basic implementation 2020-07-23 02:26:45 +02:00
Jenkinsfile reflect branch name change 2021-10-24 00:51:13 +02:00
LICENSE Create LICENSE 2020-07-23 02:57:38 +02:00
Logo.png decrease the logo's size 2021-11-04 18:34:12 +01:00
README.md added readme and logo to package 2021-11-04 18:32:37 +01:00

The ExtremelySimpleLogger logo

ExtremelySimpleLogger is a very simple logger for .NET programs.

To set up an extremely simple logger, add a reference to the NuGet package to your project file. Remember to change the VERSION to the most recent one.

<ItemGroup>
    <PackageReference Include="ExtremelySimpleLogger" Version="VERSION" />
</ItemGroup>

Next, you have to create an instance of the Logger class:

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
  • DirectorySink, which outputs logging data to a set of files and automatically manages how many old logs are kept
  • StringSink, which stores logging data in a string

There are multiple ways to easily log messages with your newly created logger:

// 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);
}

For more information, you can also check out the sample.