Skip to content
This repository was archived by the owner on Jan 18, 2020. It is now read-only.
/ NetLogger Public archive

A simple DotNet Logger to use with your NET Projects

License

Notifications You must be signed in to change notification settings

mcdikki/NetLogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NetLogger

A simple DotNet Logger to use with your NET Projects.

Table of Contents

License

License

This software is licensed under the [Gnu GPL v3] 1.

Features

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

Quick Start

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

  1. error
  2. warn
  3. log
  4. 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:

  1. Use the loglevel with logger.log
logger.log(loglevel, message)
  1. 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:

  1. Write your own logAction by implementing the ILogAction Interface
  2. Make use of the api to get the log messages

The code is easy to understand, just have a look.

Development

I've stopped developing, maintaining and using this tool. There is no plan for any further development.

About

A simple DotNet Logger to use with your NET Projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published