-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sdk-logs] Update LogRecord to keep CategoryName and Logger in sync (#…
- Loading branch information
1 parent
8ff986b
commit 10f8a0d
Showing
7 changed files
with
106 additions
and
36 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
2 changes: 1 addition & 1 deletion
2
src/OpenTelemetry/.publicApi/Experimental/PublicAPI.Unshipped.txt
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,29 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System.Collections.Concurrent; | ||
using OpenTelemetry.Logs; | ||
|
||
namespace OpenTelemetry.Internal; | ||
|
||
internal sealed class InstrumentationScopeLogger : Logger | ||
{ | ||
private static readonly ConcurrentDictionary<string, InstrumentationScopeLogger> Cache = new(); | ||
|
||
private InstrumentationScopeLogger(string name) | ||
: base(name) | ||
{ | ||
} | ||
|
||
public static InstrumentationScopeLogger Default { get; } = new(string.Empty); | ||
|
||
public static InstrumentationScopeLogger GetInstrumentationScopeLoggerForName(string? name) | ||
{ | ||
return string.IsNullOrWhiteSpace(name) | ||
? Default | ||
: Cache.GetOrAdd(name!, static n => new(n)); | ||
} | ||
|
||
public override void EmitLog(in LogRecordData data, in LogRecordAttributeList attributes) | ||
=> throw new NotSupportedException(); | ||
} |
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