A highly configurable logger written in C# and .Net Standard 2.0
C#MIT
Salem
A highly configurable logger written entirely in C# and .Net Standard 2.0
(more about the supported platforms below)
Status:
Branch
Build
Tests
Code Quality
Master
Dev
Supported platforms:
.Net Core 2.0 and above
.Net Framework 4.6.1 and above
Mono 5.4 and above
Xamarin.iOS 10.14 and above
Xamarin.Mac 3.8 and above
Xamarin.Android 8.0 and above
UWP 10.0.16299 and above
2018.1 and above
Usage
The simplest usage
using Salem;varlogger=new Logger();//The first parameter - log level (for example: info, warning or error) (Not case-sensitive)//The second parameter - our message (string or any object)//The third parameter - scope (no need to specify if the same as scope in the constructor or empty)
logger.Log("Info","Files have been loaded successfully");
logger.Log("Warning","Aliens have arrived");
logger.Log("Error","World is going to be destroyed by the aliens");
Formatters
Lists and dictionaries
Without a scope
using Salem;using System.Collections.Generic;varlogger=new Logger();varlist=newList<string>(){"one","two","three"};
logger.Log("info", list);
using Salem;using System.Collections.Generic;varlogger=new Logger();vardict=newDictionary<string,string>(){{"1","first"},{"2","second"},{"3","third"}};
logger.Log("info", dict);
With a scope
using Salem;using System.Collections.Generic;varlogger=new Logger("Scope");varlist=newList<string>(){"one","two","three"};
logger.Log("info", list);
using Salem;using System.Collections.Generic;varlogger=new Logger("Scope");vardict=newDictionary<string,string>(){{"1","first"},{"2","second"},{"3","third"}};
logger.Log("info", dict);