A simple DotNet Logger to use with your NET Projects.
This software is licensed under the [Gnu GPL v3] 1.
NetLogger is a easy to use logging tool. Loggin to a console or file is as hard as coding helloWorld.
NetLogger offers
- 5 loglevels from critical to debug
- built in easy to use colored console output
- built in easy to use file output
- support for multiple outputs with different loglevels
- automatic Timestamping
- simple api for fast integration into existing projects
- easy configuration with xml
- good extensiblity
To start with NetLogger:
- add the project or dll to your NET project
- import the namespace logger
import logger
- add a logAction
logger.addLogAction(logger.stdLogAction)
- log your messages
logger.log(message)
Now that you know how to start, lets have a look at some important things. The main concept of NetLogger is to proceed the logging input and output separatly. You can allways log, but as long as you add a logAction to the logger, nobody will ever see it. You can add as much log actions as you want. NetLogger contains two types of logActions
- consoleLogger
- fileLogger
and has a predefined builtIn LogAction which you can access with logger.stdLogAction.
But you can easiely extend it to fit your needs. Maybe a dataBaseLogger?
As most loggers, NetLogger makes use of loglevels.
It supports
0. critical
- error
- warn
- log
- debug
Each logAction is listing to messages with a given loglevel and below.
Lets assume you want to create a logfile for warnings, errors etc.
logger.addLogAction(new fileLogger(2,logfile,true)
Ok, so far for the logActions. How to log? You have two ways to log:
- Use the loglevel with logger.log
logger.log(loglevel, message)
- Use the named methods
logger.critical(message)
logger.err(message)
logger.warn(message)
logger.log(message)
logger.debug(message)
As you may mentioned, you don't need a instance of logger. As everythink is Shared / Static, there is no need of passing the looger around your classes and modules.
Last but not least. You may want to extend NetLogger to fit your needs. This can be done in two ways:
- Write your own logAction by implementing the ILogAction Interface
- Make use of the api to get the log messages
The code is easy to understand, just have a look.
I've stopped developing, maintaining and using this tool. There is no plan for any further development.