User Tools

Site Tools


Sidebar

Nebol Software Projects:

.NET Class Libraries

Contact info:

johan@nebol.se

nebollogger

This is an old revision of the document!


NebolLogger

NebolLogger is a C# package for quick and simple logging to database, file, or other destinations.

Quick example to give you an idea of how it works

// First create the destination for the log output: 
var dailyfile = new Destination_File(@"C:\TEMP","NebolLoggerDemo", "log", Rotation.Daily); 

// adding the destination to the logger 
Logger.Instance.Destinations.Add(dailyfile); 

// while we're at it, let's output to the console as well, but only if it's an error or worse 
var console = new Destination_Console(); console.Filters.Add(new Filter_Level(LogType.error)); Logger.Instance.Destinations.Add(console); 

// now we can use the logger in our program, this line will appear only in the file 
Logger.Instance.Trace("Testing the new logger, it's working nicely!"); 

// this line will appear in both the file and in the console 
Logger.Instance.Error("Oops, something went wrong!");
nebollogger.1628295222.txt.gz · Last modified: 2021/08/07 02:13 by nebol