Overview
MetroLog is a lightweight logging framework designed for Windows Store and Windows Phone 8 apps. Although the API is based on NLog and log4net, the intention is that it's a very basic logging system.
The need for it to be basic comes from the fact that the Windows Store apps API surface area intentionally limited for very specific applications. This project came out of the fact that porting NLog to Windows Store apps is difficult because of it's incredibly rich feature set, most of which is not workable in Windows Store apps.
Out-of-the-box, logging operations are intended to send all log levels to Debug.WriteLine
and EventTracingForWindows (ETW).
and ERROR and FATAL levels to a file in the app's LocalState
folder using FileSnapshotTarget.
Caution on using Debug.WriteLine
with NuGet. The NuGet packages are compiled as RELEASE mode and Debug.WriteLine
calls are #ifdef'd out. Use
the ETW mode, or FileStreamingTarget to see levels TRACE through WARN.
For Windows Store apps we recommend that you configure the SQLiteTarget. For support purposes, you can load entries back out of the SQLite database and package them for email over the Share charm.
You can use JsonPostTarget to stream log messages back to an HTTP/HTTPS end-point of your own design. (Although we provide a sample app.)
We ensure that MetroLog is compataible with WACK requirements.
Documentation
The intention is that MetroLog is mostly compatible with NLog. Both the surface area and internal construction should just about match.
To get started, read the Configuration entry in the wiki.
Unit testing
This project uses xUnit.NET, rather than the built-in MSTest. Use the xUnit.NET Test Runner for Visual Studio 2012 to enable VS 2012 to discover and run the unit tests.
Meta
This is an open source project that welcomes contributions/suggestions/bug reports from those who use it. If you have any ideas on how to improve the library, please contact @mbrit or @onovotny.
MetroLog is distributed under the MIT license.