Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Home

mbrit edited this page · 19 revisions

Principles

Configuration - basic configuration instructions.

UsingAnIoCPattern - information on using MetroLog an isolation of control (IoC) "mode".

Windows Store apps: Recommendations are that you configure the WindowsStoreAppCrashHandler, and set-up the [[SQLiteTarget]]. The SQLiteTarget has a routine that allows you to read previously written log files, package them as a text file and then share them over the Share charm.

Sequencing

Due to the nature of the TPL, we cannot guarantee the order in which entries are written into logs. Use the sequence number of entries (usually the first value) to dereference the actual order in which entries were queues for writing.

Most targets will also reference a session. This session is unique per run of the application. See SessionsAndEnvironments.

Targets

Review the Configuration page to learn how to add new targets and change from the DefaultConfiguration.

DebugTarget - this target will write log entries to Debug.WriteLine. Note: if you're using the NuGet packages, this likely will not work as Debug.WriteLine is a no-op call in RELEASE builds. If you want to use this, you'll need to download the code and build a DEBUG version.

EtwTarget - this target will write log entries to EventTracingForWindows. (All platforms.)

[[JsonPostTarget]] - this target will collect and post log entries as JSON over HTTP. (All platforms.)

[[FileSnapshotTarget]] - this target will create a single file per log event. By default, the standard configuration will create one of these for ERROR and FATAL levels. Errors are written to ~/LocalState/MetroLogs. (Windows Store apps only.)

[[FileStreamingTarget]] - this target will stream log entries into a single file. (Windows Store apps only.)

[[SQLiteTarget]] - this target will stream log entries into a local SQLite database. The SQLite target is highly recommended for Windows Store apps. (Windows Store apps only.)

Base target types

Target - base implementation of a target. Typically you do not extend from these, but extend from AsyncTarget or SyncTarget.

AsyncTarget - base implementation of a target where the intention is that the write operation is asynchronous (e.g. writing to a file, or network end-point).

SyncTarget - base implementation of a target where the intention is that the write operation is synchronous.

BufferedTarget - base implementation of a target where entries are held in memory until they are flushed in a single operation. This class is most likely to be used with targets that write to a network location. In Windows Store apps, BufferedTarget instances are tracked and flushed when the app is suspended.

FileTargetBase - base class for file targets (Windows Store apps only).

Layouts

Something went wrong with that request. Please try again.