-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 7, 2024
1 parent
0afe5e1
commit 829801e
Showing
6 changed files
with
163 additions
and
12 deletions.
There are no files selected for viewing
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; } | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
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,24 @@ | ||
// 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> | ||
/// 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> | ||
/// Gets 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