Logging Framework

Just a new logging framework: 
https://github.com/mbrenn/BurnSystems.Logging

It offers a slim and simplified possibility to perform logging on console, debug interface or into the file. In future, it will be used within the DatenMeister. I know, there are other, very good logging frameworks for .Net, like log4net or NLog. They have better content, a more beautiful website and a framework, which has been integrated into 100s of websites, applications and tools. 

So… Why, this one? Because I can.


BurnSystems.Logging

PDF on https://github.com/mbrenn/BurnSystems.Logging/blob/master/docs/BurnSystems.Logging.pdf

Purpose

The assembly BurnSystems.Logging introduces a lightweight logging tool supporting console output, debug output and a very simple internal storage for log messages.

The logger is available via a singleton „TheLog“ in namespace “BurnSystems.Logging”.

The assembly is a .Net Standard 2.1 assembly, so it can be used under all platforms supporting .Net Core (including Linux).

using BurnSystems.Logging.Provider;
namespace BurnSystems.Logging.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            TheLog.AddProvider(new ConsoleProvider(), LogLevel.Info);
            TheLog.Trace("Not added");
            TheLog.Info("We have an info message.");
            TheLog.Error("Error Occured....");
            TheLog.Fatal("We have to quit the application due to loss of O².");
        }
    }
}

We also have included a class logger which eases the logging of events in certain classes. Sorting and Filtering can be made much easier.

public class WorkingMan
{
    private ILogger logger = new ClassLogger(typeof(WorkingMan));
    public void Work()
    {
        logger.Info("We are working.");
    }
}

Usage

The following loglevels are predefined:

  • Trace = 1,
  • Debug = 2,
  • Info = 3,
  • Warn = 4,
  • Error = 5,
  • Fatal = 6

Providers

The following providers are supported in the first release:

  1. ConsoleProvider: Each message is sent to the console
  2. DebugProvider: Each message is sent to the Debug stream
  3. InMemoryDatabaseProvider: A very simple database provider just being capable to store each log entry into a list. Not recommended for long running services since it will eat up your memory.
  4. FileProvider: Each message will be added to a given file. During set-up of the provider, it may be decided whether the log will be extended or whether it will be cleaned up.