This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NLog ApplicationInsightsTarget - GlobalDiagnosticContext must be expl…
…ictly added using ContextProperties
- Loading branch information
Showing
4 changed files
with
93 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="ApplicationInsightsTarget.cs" company="Microsoft"> | ||
// Copyright (c) Microsoft Corporation. | ||
// All rights reserved. 2013 | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Microsoft.ApplicationInsights.NLogTarget | ||
{ | ||
using NLog.Config; | ||
using NLog.Layouts; | ||
|
||
/// <summary> | ||
/// NLog Target Context Property that allows capture of context information for all logevents (Ex. Layout=${threadid}) | ||
/// </summary> | ||
[NLogConfigurationItem] | ||
[ThreadAgnostic] | ||
public class TargetPropertyWithContext | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TargetPropertyWithContext" /> class. | ||
/// </summary> | ||
public TargetPropertyWithContext() : this(null, null) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TargetPropertyWithContext" /> class. | ||
/// </summary> | ||
/// <param name="name">The name of the attribute.</param> | ||
/// <param name="layout">The layout of the attribute's value.</param> | ||
public TargetPropertyWithContext(string name, Layout layout) | ||
{ | ||
this.Name = name; | ||
this.Layout = layout; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the attribute. | ||
/// </summary> | ||
/// <docgen category='Property Options' order='10' /> | ||
[RequiredParameter] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the layout that will be rendered as the attribute's value. | ||
/// </summary> | ||
/// <docgen category='Property Options' order='10' /> | ||
[RequiredParameter] | ||
public Layout Layout { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters