SimpleLogs4Net

Simple Logs Library for .Net

View on GitHub

Initialization

First of all you need to add using the namespace

using SimpleLogs4Net;
//using this line you can initialize Logs

Then you need to

new Log(AppDomain.CurrentDomain.BaseDirectory + "Logs\\");
//using this line you can initialize Logs

Initialization is now Simplified

Log.Initialize(AppDomain.CurrentDomain.BaseDirectory + "Logs\\");
//using this line you can initialize Logs

If you want to change Output Stream

Log.ChangeOutputStream(OutputStream.None);
Log.ChangeOutputStream(OutputStream.Console);
Log.ChangeOutputStream(OutputStream.File);
Log.ChangeOutputStream(OutputStream.Both);

Usage

You can add an event using Log.AddEvent

Log.AddEvent(new Event("text", EType.Normal));

Adding text to Logs is now simplified

Log.Write("text", EType.Normal);
Log.Write("text");
//Log will be set to Default Type
Log.ChangeDefaultType(EType.Informtion);
//Using /\ this line you can change default type

You can use Events in many different ways

Log.AddEvent(new Event("text", EType.Normal));
Log.AddEvent(new Event("text", EType.Error));
Log.AddEvent(new Event("text", EType.Warning));
Log.AddEvent(new Event("text", EType.Informtion));
Log.AddEvent(new Event("text", EType.Normal));
Log.AddEvent(new Event("text", EType.Critical_Error));
//Sample Output 
//[23.05.2022-14:47:44][INFO]text
//[23.05.2022-14:47:44][INFO]text
//[23.05.2022-14:47:44][ERROR]text
//[23.05.2022-14:47:44][WARNING]text
//[23.05.2022-14:47:44][INFO]text

To make new log You Can Use NextLog

Log.NextLog();

multiline

Log.AddEvent(new Event(multilinestring, EType.Normal));

SimpleLogs4Net include simple way to delete all log files

Log.ClearLogs();