Code Monkey home page Code Monkey logo

extensibleloggerlibrary's Introduction

Extensible Logger Library


This is a logging library which can be extended by new logging libraries and wrappers to be used on .NET applications to log all kind of log entries.


Already Defined Loggers:

  • Log4Net
  • EventLog

Features:

  • Create your own loggers or use already defined
  • Add multiple concurrent loggers at runtime
  • Enable/disable loggers at runtime

Design Aspects:

  • SOLID principles
  • Separation of concerns
  • Extensible

How To Use:

ILoggerManager loggerManager = new LoggerManager();
SystemLogger systemLogger = new SystemLogger(loggerManager);

Dictionary<string, object> settings = new Dictionary<string, object>();
settings.Add("Log4Net.ConversionPattern", "%date [%thread] %-5level %logger - %message%newline");
settings.Add("Log4Net.MaximumFileSize", "1MB");
settings.Add("Log4Net.MaxSizeRollBackups", 5);
settings.Add("Log4Net.File", @"d:\Log4NetLogger.txt");

ILogger log4NetLogger = new Log4NetLogger("Log4NetLogger");     
log4NetLogger.Configure(settings);
loggerManager.AddLogger("Log4NetLogger", log4NetLogger);

ILogger eventLogLogger = new EventLogLogger("TestApp", "Application", 400, null);
loggerManager.AddLogger("EventLogLogger", eventLogLogger);

systemLogger.LogInfo("This is my first info log.");
systemLogger.LogDebug("This is my first debug log.");
systemLogger.LogWarning("This is my first warning log.");
systemLogger.LogError(ErrorSeverity.Low, "This is my first low error log.", new Exception("This is my first low error log."));
systemLogger.LogError(ErrorSeverity.Medium, "This is my first medium error log.", new Exception("This is my first medium error log."));
systemLogger.LogError(ErrorSeverity.High, "This is my first high error log.", new Exception("This is my first high error log."));
systemLogger.LogError(ErrorSeverity.Extreme, "This is my first extreme error log.", new Exception("This is my first extreme error log."));
systemLogger.LogMethodStart("static void Main(string[] args)", new string[] { "args" }, new object[] { args });
systemLogger.LogMethodEnd("static void Main(string[] args)", true);
systemLogger.LogMethodEnd("static void Main(string[] args)", false);

Results:


Authors:

extensibleloggerlibrary's People

Contributors

ahmedtarekhasan avatar

Watchers

 avatar  avatar

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.