Project Description
SpringTail is a simple Logging Framework Abstraction library for Silverlight 2 and .net. It provides a separation of your logging code from a logging framework. This enables you to select a logging backend most suitable for your type of application without modifying your source.

When is SpringTail useful?
The choice of which log sink to use is dependant on the type of application to be deployed. A console app will commonly log to the console window, desktop app to file, and a server app possibly to a database. The many .net logging frameworks available all offer similar sinks and functionality so you may ask why is logging framework abstraction useful? If you develop class libraries which could be used by any type of application, then ideally you should log to a logging framework common across the application, so logs are centrally located. But what is that logging framework? You could decide and ship your library with a dependency on one of the frameworks, but that won't be attractive to an application developer who wants to use a different one. Also consider your library could be used in a console or Silverlight application where an over featured logging framework is not necessary. This is where a logging framework abstraction like SpringTail is useful. It's very small and is only focussed on forwarding logging calls from your code to a target specified by the application developer. This could be their favourite logging framework or simply Console.Out.

Integrating SpringTail is very simple and requires no configuration. Logging is performed by calling one of the Log functions on instances of SpringTail.Logger. A LogMessage is constructed and passed to the static Logger.LogAction. This is a property of type Action<LogMessage> and should be set with bridging code to the logging system of your choice.

Logger construction
// construct a Logger with a name and optionally its hosting object
Logger logger = new Logger("Address Book");
logger.Log(LogLevel.Info, "connection opened");

// explicitly log Debug/Info/Warn/Error/Fatal
logger.Debug("connection opened");

// optionally pass an object
logger.Warn("connection opened", someData);

// log an exception
logger.ErrorException("connection failed", theException);
Logging integration
// bridge to one or more logging systems
// m is an instance of SpringTail.LogMessage
Logger.LogAction = m => myLogSystem.Log(m.LoggerName, Convert(m.Level), m.Message);

Last edited Nov 3, 2008 at 7:50 PM by mikesaunders, version 7