-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added NLogProviderOptions.IncludeActivtyIdsWithBeginScope, added .NET…
… 5 build, move tests to .NET Core LTS (#456) * Added NLogProviderOptions.IncludeActivtyIdsWithBeginScope * Fix build warnings about targetframeworks being out of support * Fix build warning about obsolete PackageLicenseUrl * Added net50 to build script * Fix build-warning about PackageIconUrl being obsolete * Fix build warnings about targetframeworks being out of support * Update build scripts to not use targetframeworks being out of support * Added NLogProviderOptions.IncludeActivtyIdsWithBeginScope (RequestPath validation) * test for .NET 5 * tests with opencover * fix duplicate in csproj * fix duplicate in csproj v2 Co-authored-by: Julian Verdurmen <304NotModified@users.noreply.github.com>
- Loading branch information
1 parent
bd98259
commit 41b4a13
Showing
10 changed files
with
196 additions
and
25 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
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,44 @@ | ||
#if NET5_0 | ||
|
||
using System.Diagnostics; | ||
|
||
namespace NLog.Extensions.Logging | ||
{ | ||
/// <summary> | ||
/// Helpers for getting the right values from Activity no matter the format (w3c or hierarchical) | ||
/// </summary> | ||
internal static class ActivityExtensions | ||
{ | ||
public static string GetSpanId(this Activity activity) | ||
{ | ||
return activity.IdFormat switch | ||
{ | ||
ActivityIdFormat.Hierarchical => activity.Id, | ||
ActivityIdFormat.W3C => activity.SpanId.ToHexString(), | ||
_ => null, | ||
} ?? string.Empty; | ||
} | ||
|
||
public static string GetTraceId(this Activity activity) | ||
{ | ||
return activity.IdFormat switch | ||
{ | ||
ActivityIdFormat.Hierarchical => activity.RootId, | ||
ActivityIdFormat.W3C => activity.TraceId.ToHexString(), | ||
_ => null, | ||
} ?? string.Empty; | ||
} | ||
|
||
public static string GetParentId(this Activity activity) | ||
{ | ||
return activity.IdFormat switch | ||
{ | ||
ActivityIdFormat.Hierarchical => activity.ParentId, | ||
ActivityIdFormat.W3C => activity.ParentSpanId.ToHexString(), | ||
_ => null, | ||
} ?? string.Empty; | ||
} | ||
} | ||
} | ||
|
||
#endif |
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
Oops, something went wrong.