Giter VIP home page Giter VIP logo

logger's Introduction

CodeDead.Logger

This repository contains a simple, yet extensible logging library for .NET Framework applications. Some of the capabilities included in this library are the ability to write logs to any number of different files at the same time, writing your own appending logic and even writing logs asynchonously. It is highly recommended to look at the code samples to get a general idea of the workflow.

NuGet

This library is available as a NuGet package: #TODO

Dependencies

Example usage

// Logger objects can be generated using the LogFactory using either a key:
// Logger logger = LogFactory.GenerateLogger("MAIN");
// Or a default Logger object can be retrieved
Logger logger = LogFactory.GenerateLogger();
string defaultName = logger.Name;

// This is the default console appender but you can implement the LogAppender or ConsoleAppender to write your own logic
DefaultConsoleAppender consoleWriter = new DefaultConsoleAppender();
// This is the default file appender but you can implement the LogAppender or FileAppender to write your own logic
DefaultFileAppender fileAppender = new DefaultFileAppender(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\exampleLog.log");
// You can have as many appenders as your system allows
logger.LogManager.AddLogAppender(consoleWriter);
logger.LogManager.AddLogAppender(fileAppender);

// Defaults
logger.Trace("Hello trace!");
logger.Debug("Hello debug!");
logger.Info("Hello info!");
logger.Warn("Hello warn!");
logger.Error("Hello error!");

Appenders

Appenders are used for 'appending' logs to a specific output:

Class Description
DefaultConsoleAppender Default implementation of the ConsoleAppender that can be used for writing logs to the console using a Format that can be customized
DefaultFileAppender Default implementation of the FileAppender that can be used for writing logs to a file using a Format that can be customized
JsonFileAppender A spin of the FileAppender that can write logs as a JSON file
XmlFileAppender A spin of the FileAppender that can write logs as an XML file
CsvFileAppender A spin of the FileAppender that can write logs in CSV format. You can adjust the delimiter using the Delimiter property
WindowsEventAppender A spin of the EventAppender that can write logs to the Windows Event Log

FileConfiguration

FileConfiguration implementations can be used to extend the capabilities of FileAppender implementations:

Class Description
FileArchiver Implementation of the FileConfiguration class that can be used to archive log files using a ZipPath that can be customized
FileMover Implementation of the FileConfiguration class that can be used to move log files to a Directory that can be customized

TODO

  • Allow loggers to be read/exported to/from a file (JSON/XML)
  • Write the code for the DefaultFileAppender
  • Write the code for the XmlFileAppender
  • Write the code for the JsonFileAppender
  • Write the code for the CsvFileAppender
  • Write the code for the WindowsEventAppender
  • Implement the FileConfiguration classes
  • Write documentation
  • Write contribution guidelines
  • Publish on NuGet

About

This library is maintained by CodeDead. You can find more about us using the following links:

We would also like to thank JetBrains for the open source license that they granted us to work with wonderful tools such as Rider and Resharper.

logger's People

Contributors

codedead avatar

Watchers

 avatar  avatar  avatar

Forkers

rakhithjk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.