Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (24 sloc) 0.724 kb
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MetroLog.Layouts;
using MetroLog.Targets;
namespace MetroLog.WinRT
{
class EventTarget : SyncTarget
{
private readonly Action<string> _onMessage;
public EventTarget(Action<string> onMessage) : base(new SingleLineLayout())
{
if (onMessage == null) throw new ArgumentNullException("onMessage");
_onMessage = onMessage;
}
protected override void Write(LogWriteContext context, LogEventInfo entry)
{
var message = Layout.GetFormattedString(context, entry);
_onMessage(message);
}
}
}
Jump to Line
Something went wrong with that request. Please try again.