EasyNetLog is a simple logging solution for any .NET project.
To create a new logger instance, use the main constructor of EasyNetLogger
.
The constructor has 4 parameters:
logFormat
Allows you to set a post-processor for logs.includeConsoleStream
Will force the logger to write logs to a console.files
An array of file paths that the logger will write to.customLogStreams
An array of TextWriter streams that the logger will write to.
EasyNetLog has a simple XML formatting system that allows you to add some colors to your logs.
The color formatter supports known color names and HEX color codes.
Example:
"<color=red>I'm red!</color>"
Sometimes you have to log user input, but don't want it to be formatted.
You can ignore text formats using <ignore>
.
Example:
"<ignore><color=red>I'm not red!</color></ignore>"
var logger = new EasyNetLogger((x) => $"[<color=magenta>{DateTime.Now:HH:mm:ss.fff}</color>] <color=gray>{x}</color>", true, new string[]
{
@"test.log"
}, null);
for (; ; )
{
logger.Log("A cool <color=#e63d6d>fuity</color> <color=#94ff2a>log</color> :)");
Thread.Sleep(1000);
}