Skip to content

Commit

Permalink
[api-logs] Removed default parameter from the EmitLog API (#4559)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch authored Jun 7, 2023
1 parent f786f59 commit 1143c52
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
abstract OpenTelemetry.Logs.Logger.EmitLog(in OpenTelemetry.Logs.LogRecordData data, in OpenTelemetry.Logs.LogRecordAttributeList attributes = default(OpenTelemetry.Logs.LogRecordAttributeList)) -> void
abstract OpenTelemetry.Logs.Logger.EmitLog(in OpenTelemetry.Logs.LogRecordData data, in OpenTelemetry.Logs.LogRecordAttributeList attributes) -> void
abstract OpenTelemetry.Logs.LoggerProviderBuilder.AddInstrumentation<TInstrumentation>(System.Func<TInstrumentation!>! instrumentationFactory) -> OpenTelemetry.Logs.LoggerProviderBuilder!
OpenTelemetry.Logs.IDeferredLoggerProviderBuilder
OpenTelemetry.Logs.IDeferredLoggerProviderBuilder.Configure(System.Action<System.IServiceProvider!, OpenTelemetry.Logs.LoggerProviderBuilder!>! configure) -> OpenTelemetry.Logs.LoggerProviderBuilder!
OpenTelemetry.Logs.Logger
OpenTelemetry.Logs.Logger.EmitLog(in OpenTelemetry.Logs.LogRecordData data) -> void
OpenTelemetry.Logs.Logger.Logger(string? name) -> void
OpenTelemetry.Logs.Logger.Name.get -> string!
OpenTelemetry.Logs.Logger.Version.get -> string?
Expand Down Expand Up @@ -76,4 +77,4 @@ OpenTelemetry.Logs.LogRecordSeverity.Warn4 = 16 -> OpenTelemetry.Logs.LogRecordS
OpenTelemetry.Logs.LogRecordSeverityExtensions
static OpenTelemetry.Logs.LogRecordAttributeList.CreateFromEnumerable(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>! attributes) -> OpenTelemetry.Logs.LogRecordAttributeList
static OpenTelemetry.Logs.LogRecordSeverityExtensions.ToShortName(this OpenTelemetry.Logs.LogRecordSeverity logRecordSeverity) -> string!
virtual OpenTelemetry.Logs.LoggerProvider.TryCreateLogger(string? name, out OpenTelemetry.Logs.Logger? logger) -> bool
virtual OpenTelemetry.Logs.LoggerProvider.TryCreateLogger(string? name, out OpenTelemetry.Logs.Logger? logger) -> bool
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
abstract OpenTelemetry.Logs.Logger.EmitLog(in OpenTelemetry.Logs.LogRecordData data, in OpenTelemetry.Logs.LogRecordAttributeList attributes = default(OpenTelemetry.Logs.LogRecordAttributeList)) -> void
abstract OpenTelemetry.Logs.Logger.EmitLog(in OpenTelemetry.Logs.LogRecordData data, in OpenTelemetry.Logs.LogRecordAttributeList attributes) -> void
abstract OpenTelemetry.Logs.LoggerProviderBuilder.AddInstrumentation<TInstrumentation>(System.Func<TInstrumentation!>! instrumentationFactory) -> OpenTelemetry.Logs.LoggerProviderBuilder!
OpenTelemetry.Logs.IDeferredLoggerProviderBuilder
OpenTelemetry.Logs.IDeferredLoggerProviderBuilder.Configure(System.Action<System.IServiceProvider!, OpenTelemetry.Logs.LoggerProviderBuilder!>! configure) -> OpenTelemetry.Logs.LoggerProviderBuilder!
OpenTelemetry.Logs.Logger
OpenTelemetry.Logs.Logger.EmitLog(in OpenTelemetry.Logs.LogRecordData data) -> void
OpenTelemetry.Logs.Logger.Logger(string? name) -> void
OpenTelemetry.Logs.Logger.Name.get -> string!
OpenTelemetry.Logs.Logger.Version.get -> string?
Expand Down Expand Up @@ -76,4 +77,4 @@ OpenTelemetry.Logs.LogRecordSeverity.Warn4 = 16 -> OpenTelemetry.Logs.LogRecordS
OpenTelemetry.Logs.LogRecordSeverityExtensions
static OpenTelemetry.Logs.LogRecordAttributeList.CreateFromEnumerable(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string!, object?>>! attributes) -> OpenTelemetry.Logs.LogRecordAttributeList
static OpenTelemetry.Logs.LogRecordSeverityExtensions.ToShortName(this OpenTelemetry.Logs.LogRecordSeverity logRecordSeverity) -> string!
virtual OpenTelemetry.Logs.LoggerProvider.TryCreateLogger(string? name, out OpenTelemetry.Logs.Logger? logger) -> bool
virtual OpenTelemetry.Logs.LoggerProvider.TryCreateLogger(string? name, out OpenTelemetry.Logs.Logger? logger) -> bool
9 changes: 8 additions & 1 deletion src/OpenTelemetry.Api/Logs/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,21 @@ protected Logger(string? name)
/// </summary>
public string? Version { get; private set; }

/// <summary>
/// Emit a log.
/// </summary>
/// <param name="data"><see cref="LogRecordData"/>.</param>
public void EmitLog(in LogRecordData data)
=> this.EmitLog(in data, default);

/// <summary>
/// Emit a log.
/// </summary>
/// <param name="data"><see cref="LogRecordData"/>.</param>
/// <param name="attributes"><see cref="LogRecordAttributeList"/>.</param>
public abstract void EmitLog(
in LogRecordData data,
in LogRecordAttributeList attributes = default);
in LogRecordAttributeList attributes);

internal void SetInstrumentationScope(
string? version)
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Api/Logs/NoopLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public NoopLogger()

public override void EmitLog(
in LogRecordData data,
in LogRecordAttributeList attributes = default)
in LogRecordAttributeList attributes)
{
}
}
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Logs/ILogger/OpenTelemetryLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private LoggerInstrumentationScope(string name, string version)
public static LoggerInstrumentationScope Instance { get; }
= new("OpenTelemetry", typeof(OpenTelemetryLogger).Assembly.GetName().Version?.ToString() ?? "1.0.0");

public override void EmitLog(in LogRecordData data, in LogRecordAttributeList attributes = default)
public override void EmitLog(in LogRecordData data, in LogRecordAttributeList attributes)
=> throw new NotSupportedException();
}
}
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Logs/LoggerSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public LoggerSdk(
}

/// <inheritdoc />
public override void EmitLog(in LogRecordData data, in LogRecordAttributeList attributes = default)
public override void EmitLog(in LogRecordData data, in LogRecordAttributeList attributes)
{
var provider = this.loggerProvider;
var processor = provider.Processor;
Expand Down
2 changes: 1 addition & 1 deletion test/OpenTelemetry.Api.Tests/Logs/LoggerProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public TestLogger(string? name)
{
}

public override void EmitLog(in LogRecordData data, in LogRecordAttributeList attributes = default)
public override void EmitLog(in LogRecordData data, in LogRecordAttributeList attributes)
{
}
}
Expand Down

0 comments on commit 1143c52

Please sign in to comment.