This project is read-only.

LogRepository Class

Namespace: DotNetMigrations.Repositories
Access: Internal
Inherits/Implements: ILogger (interface)


The LogRepository Class was created as a class that can discover, instantiate, and aggregate multiple logging mechanisms of the application into a single unified source. Using MEF, the LogRepository examines the <dnm.logs> configuration section for what classes that implement the ILogger interface and are decorated with the appropriate MEF part Export attribute, instantiates them, and then sends all messages to them. Due to MEF's ability to inherit part Export settings, the LoggerBase class was created to make it easier to create custom logs should the need arise.

The LogRepository conforms to the same interface that it's collection of logs implement. The LogRepository does not do any formatting of any messages. Instead, it just passes all messages to the same methods of all of the logs it contains.

Public Methods:

Name Purpose Notes
GetLog Returns a specific log from the repository. Was added in the event a command only wanted to log to 1 of the loaded logs and not all of them.
WriteLine Writes a string message to all loaded logs.
WriteWarning Writes a warning string message to all loaded logs.
WriteError Writes an error string message to all loaded logs.
Dispose Calls the IDisposable.Dispose method on all loaded logs.

Last edited Jan 30, 2010 at 12:51 AM by JamesEggers, version 1


No comments yet.