Skip to content

EasyNetLog is a simple logging solution for any .NET project.

License

Notifications You must be signed in to change notification settings

slxdy/EasyNetLog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyNetLog

EasyNetLog is a simple logging solution for any .NET project.

Usage

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.

Formatting

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>"

EasyNetLog Example Usage

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

image

About

EasyNetLog is a simple logging solution for any .NET project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages