Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
Adem Catamak edited this page Mar 25, 2018 · 7 revisions

When package is installed with adapter, log4net.config file (RapidLogger.Log4NetAdapter) or nlog.config file

(RapidLogger.NLogAdapter) are added in project.

Project has own config file and other requirements, so you do not have to change anything.

  • On the other hand, if you want, you can change "log4net.config" or "nlog.config" file. Moreover, if you have own custom config file, you can use it.

Note: ConfigFilePath can be both relative or absolute

Usage Example

I presume you do not change anything and I give example on that version.

You have to check one thing and then you can use logger directly. log4net/nlog.config file properties be like that => "Build Action" = "Content" and "Copy to Output Directory" = "Copy Always | Copy If Newer".

(This properties are modified automatically during nuget package installation)

Whereever your code, you can use this.

LoggerMaestro rapidLogger = new LoggerMaestro();
rapidLogger.AddLogger("Console Logger Key",new ConsoleLogger());
rapidLogger.Debug("Some Info");

All logging operations are listed below :

LoggerMaestro rapidLogger = new LoggerMaestro();

rapidLogger.Debug("Some Info");
rapidLogger.Info("Some Info");
rapidLogger.Error("Some Info", new Exception("Exception Message"));
rapidLogger.Error(new Exception("Exception Message"));

Besides you can use this logger class with IoC container like:

  • AutoFac
LoggerMaestro rapidLogger = new LoggerMaestro();
rapidLogger.AddLogger("Console Logger Key",new ConsoleLogger());

builder.Register(rapidLogger)
       .As<LoggerMaestro>()
       .PropertiesAutowired();

Clone this wiki locally