-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce IBufferedLogRecordMetadata
- Loading branch information
Martin Taillefer
committed
Jun 10, 2024
1 parent
0afe5e1
commit 6ad50f7
Showing
10 changed files
with
198 additions
and
13 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
34 changes: 34 additions & 0 deletions
34
src/libraries/Microsoft.Extensions.Logging.Abstractions/src/BufferedLogRecordMetadata.cs
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,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace Microsoft.Extensions.Logging | ||
{ | ||
/// <summary> | ||
/// Holds metadata for a buffered log record. | ||
/// </summary> | ||
public struct BufferedLogRecordMetadata | ||
{ | ||
/// <summary> | ||
/// Gets the time when the log record was recorded. | ||
/// </summary> | ||
public DateTimeOffset CreationTime { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the thread that created the log record. | ||
/// </summary> | ||
public int? ManagedThreadId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the span in effect when the log record was created. | ||
/// </summary> | ||
public ActivitySpanId? SpanId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the trace in effect when the log record was created. | ||
/// </summary> | ||
public ActivityTraceId? TraceId { get; set; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/libraries/Microsoft.Extensions.Logging.Abstractions/src/IBufferedLogRecord.cs
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,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Microsoft.Extensions.Logging | ||
{ | ||
/// <summary> | ||
/// A buffered log record. | ||
/// </summary> | ||
/// <remarks> | ||
/// If the logging infrastructure decides to buffer log records in memory, it will ensure that the | ||
/// <c>TState</c> value delivered to logging providers implements this interface. The logging providers | ||
/// can then use the metadata to augment the log records they emit. | ||
/// </remarks> | ||
public interface IBufferedLogRecord | ||
{ | ||
/// <summary> | ||
/// Extracts the metadata for the buffered log record. | ||
/// </summary> | ||
public void ExtractMetadata(out BufferedLogRecordMetadata metadata); | ||
} | ||
} |
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
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
25 changes: 25 additions & 0 deletions
25
src/libraries/Microsoft.Extensions.Logging.Console/tests/tests.sln
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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.002.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Console.Tests", "Microsoft.Extensions.Logging.Console.Tests\Microsoft.Extensions.Logging.Console.Tests.csproj", "{102F40FA-B0D2-454C-8961-246C8526E1DB}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{102F40FA-B0D2-454C-8961-246C8526E1DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{102F40FA-B0D2-454C-8961-246C8526E1DB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{102F40FA-B0D2-454C-8961-246C8526E1DB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{102F40FA-B0D2-454C-8961-246C8526E1DB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0FC155C1-F2A6-4E5E-A4BA-EDAE40CCBCD5} | ||
EndGlobalSection | ||
EndGlobal |