A very simple logger for .NET programs
Find a file
2020-07-23 02:58:35 +02:00
ExtremelySimpleLogger readme info and nuget spec 2020-07-23 02:58:25 +02:00
Sample readme info and nuget spec 2020-07-23 02:58:25 +02:00
.gitignore Initial commit 2020-07-23 02:24:18 +02:00
ExtremelySimpleLogger.sln basic implementation 2020-07-23 02:26:45 +02:00
LICENSE Create LICENSE 2020-07-23 02:57:38 +02:00
README.md readme info and nuget spec 2020-07-23 02:58:25 +02:00

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:

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:

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