|
using System.Diagnostics;
using System.Globalization;
using System.Text;
using NLog;
using NLog.LayoutRenderers;
using NLog.Config;
using NLog.Internal;
namespace LowLevelDesign.NLog.LayoutRenderers
{
/// <summary>
/// The trace correlation activity id.
/// </summary>
[LayoutRenderer("activityid")]
public class TraceActivityIdLayoutRenderer : LayoutRenderer
{
/// <summary>
/// Renders the current trace activity ID.
/// </summary>
/// <param name="builder">The <see cref="StringBuilder"/> to append the rendered data to.</param>
/// <param name="logEvent">Logging event.</param>
protected override void Append(StringBuilder builder, LogEventInfo logEvent)
{
builder.Append(Trace.CorrelationManager.ActivityId.ToString("D", CultureInfo.InvariantCulture));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.