Skip to content

Commit 2cb306f

Browse files
committed
ref(logs): rename LogSeverityLevel to SentryLogLevel
1 parent cb20118 commit 2cb306f

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

samples/Sentry.Samples.Console.Basic/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
return null;
4444
}
4545

46-
return log.Level is LogSeverityLevel.Error ? log : null;
46+
return log.Level is SentryLogLevel.Error ? log : null;
4747
});
4848
});
4949

src/Sentry/Protocol/SentryLog.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ namespace Sentry.Protocol;
1212
public sealed class SentryLog : ISentryJsonSerializable
1313
{
1414
private readonly Dictionary<string, SentryAttribute> _attributes;
15-
private readonly LogSeverityLevel _level;
15+
private readonly SentryLogLevel _level;
1616

1717
[SetsRequiredMembers]
18-
internal SentryLog(DateTimeOffset timestamp, SentryId traceId, LogSeverityLevel level, string message)
18+
internal SentryLog(DateTimeOffset timestamp, SentryId traceId, SentryLogLevel level, string message)
1919
{
2020
Timestamp = timestamp;
2121
TraceId = traceId;
@@ -46,12 +46,12 @@ internal SentryLog(DateTimeOffset timestamp, SentryId traceId, LogSeverityLevel
4646
/// <para>This API is experimental and it may change in the future.</para>
4747
/// </summary>
4848
[Experimental(DiagnosticId.ExperimentalFeature)]
49-
public required LogSeverityLevel Level
49+
public required SentryLogLevel Level
5050
{
5151
get => _level;
5252
init
5353
{
54-
LogSeverityLevelExtensions.ThrowIfOutOfRange(value);
54+
SentryLogLevelExtensions.ThrowIfOutOfRange(value);
5555
_level = value;
5656
}
5757
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Sentry.Protocol;
88
/// </summary>
99
/// <seealso href="https://develop.sentry.dev/sdk/telemetry/logs/"/>
1010
[Experimental(DiagnosticId.ExperimentalFeature)]
11-
public enum LogSeverityLevel
11+
public enum SentryLogLevel
1212
{
1313
/// <summary>
1414
/// A fine-grained debugging event.
@@ -37,9 +37,9 @@ public enum LogSeverityLevel
3737
}
3838

3939
[Experimental(DiagnosticId.ExperimentalFeature)]
40-
internal static class LogSeverityLevelExtensions
40+
internal static class SentryLogLevelExtensions
4141
{
42-
internal static (string, int?) ToSeverityTextAndOptionalSeverityNumber(this LogSeverityLevel level)
42+
internal static (string, int?) ToSeverityTextAndOptionalSeverityNumber(this SentryLogLevel level)
4343
{
4444
return (int)level switch
4545
{
@@ -59,7 +59,7 @@ internal static (string, int?) ToSeverityTextAndOptionalSeverityNumber(this LogS
5959
};
6060
}
6161

62-
internal static void ThrowIfOutOfRange(LogSeverityLevel level, [CallerArgumentExpression(nameof(level))] string? paramName = null)
62+
internal static void ThrowIfOutOfRange(SentryLogLevel level, [CallerArgumentExpression(nameof(level))] string? paramName = null)
6363
{
6464
if ((int)level is < 1 or > 24)
6565
{
@@ -68,13 +68,13 @@ internal static void ThrowIfOutOfRange(LogSeverityLevel level, [CallerArgumentEx
6868
}
6969

7070
[DoesNotReturn]
71-
private static void ThrowOutOfRange(LogSeverityLevel level, string? paramName)
71+
private static void ThrowOutOfRange(SentryLogLevel level, string? paramName)
7272
{
7373
throw new ArgumentOutOfRangeException(paramName, level, "Severity must be between 1 (inclusive) and 24 (inclusive).");
7474
}
7575

7676
[DoesNotReturn]
77-
private static T ThrowOutOfRange<T>(LogSeverityLevel level, string? paramName)
77+
private static T ThrowOutOfRange<T>(SentryLogLevel level, string? paramName)
7878
{
7979
throw new ArgumentOutOfRangeException(paramName, level, "Severity must be between 1 (inclusive) and 24 (inclusive).");
8080
}

src/Sentry/SentrySdkLogger.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,79 +26,79 @@ internal SentrySdkLogger(ISystemClock clock)
2626
}
2727

2828
/// <summary>
29-
/// Creates and sends a structured log to Sentry, with severity <see cref="LogSeverityLevel.Trace"/>, when enabled and sampled.
29+
/// Creates and sends a structured log to Sentry, with severity <see cref="SentryLogLevel.Trace"/>, when enabled and sampled.
3030
/// <para>This API is experimental and it may change in the future.</para>
3131
/// </summary>
3232
public void LogTrace(string template, object[]? parameters = null, Action<SentryLog>? configureLog = null)
3333
{
3434
if (IsEnabled())
3535
{
36-
CaptureLog(LogSeverityLevel.Trace, template, parameters, configureLog);
36+
CaptureLog(SentryLogLevel.Trace, template, parameters, configureLog);
3737
}
3838
}
3939

4040
/// <summary>
41-
/// Creates and sends a structured log to Sentry, with severity <see cref="LogSeverityLevel.Debug"/>, when enabled and sampled.
41+
/// Creates and sends a structured log to Sentry, with severity <see cref="SentryLogLevel.Debug"/>, when enabled and sampled.
4242
/// <para>This API is experimental and it may change in the future.</para>
4343
/// </summary>
4444
[Experimental(DiagnosticId.ExperimentalFeature)]
4545
public void LogDebug(string template, object[]? parameters = null, Action<SentryLog>? configureLog = null)
4646
{
4747
if (IsEnabled())
4848
{
49-
CaptureLog(LogSeverityLevel.Debug, template, parameters, configureLog);
49+
CaptureLog(SentryLogLevel.Debug, template, parameters, configureLog);
5050
}
5151
}
5252

5353
/// <summary>
54-
/// Creates and sends a structured log to Sentry, with severity <see cref="LogSeverityLevel.Info"/>, when enabled and sampled.
54+
/// Creates and sends a structured log to Sentry, with severity <see cref="SentryLogLevel.Info"/>, when enabled and sampled.
5555
/// <para>This API is experimental and it may change in the future.</para>
5656
/// </summary>
5757
[Experimental(DiagnosticId.ExperimentalFeature)]
5858
public void LogInfo(string template, object[]? parameters = null, Action<SentryLog>? configureLog = null)
5959
{
6060
if (IsEnabled())
6161
{
62-
CaptureLog(LogSeverityLevel.Info, template, parameters, configureLog);
62+
CaptureLog(SentryLogLevel.Info, template, parameters, configureLog);
6363
}
6464
}
6565

6666
/// <summary>
67-
/// Creates and sends a structured log to Sentry, with severity <see cref="LogSeverityLevel.Warning"/>, when enabled and sampled.
67+
/// Creates and sends a structured log to Sentry, with severity <see cref="SentryLogLevel.Warning"/>, when enabled and sampled.
6868
/// <para>This API is experimental and it may change in the future.</para>
6969
/// </summary>
7070
[Experimental(DiagnosticId.ExperimentalFeature)]
7171
public void LogWarning(string template, object[]? parameters = null, Action<SentryLog>? configureLog = null)
7272
{
7373
if (IsEnabled())
7474
{
75-
CaptureLog(LogSeverityLevel.Warning, template, parameters, configureLog);
75+
CaptureLog(SentryLogLevel.Warning, template, parameters, configureLog);
7676
}
7777
}
7878

7979
/// <summary>
80-
/// Creates and sends a structured log to Sentry, with severity <see cref="LogSeverityLevel.Error"/>, when enabled and sampled.
80+
/// Creates and sends a structured log to Sentry, with severity <see cref="SentryLogLevel.Error"/>, when enabled and sampled.
8181
/// <para>This API is experimental and it may change in the future.</para>
8282
/// </summary>
8383
[Experimental(DiagnosticId.ExperimentalFeature)]
8484
public void LogError(string template, object[]? parameters = null, Action<SentryLog>? configureLog = null)
8585
{
8686
if (IsEnabled())
8787
{
88-
CaptureLog(LogSeverityLevel.Error, template, parameters, configureLog);
88+
CaptureLog(SentryLogLevel.Error, template, parameters, configureLog);
8989
}
9090
}
9191

9292
/// <summary>
93-
/// Creates and sends a structured log to Sentry, with severity <see cref="LogSeverityLevel.Fatal"/>, when enabled and sampled.
93+
/// Creates and sends a structured log to Sentry, with severity <see cref="SentryLogLevel.Fatal"/>, when enabled and sampled.
9494
/// <para>This API is experimental and it may change in the future.</para>
9595
/// </summary>
9696
[Experimental(DiagnosticId.ExperimentalFeature)]
9797
public void LogFatal(string template, object[]? parameters = null, Action<SentryLog>? configureLog = null)
9898
{
9999
if (IsEnabled())
100100
{
101-
CaptureLog(LogSeverityLevel.Fatal, template, parameters, configureLog);
101+
CaptureLog(SentryLogLevel.Fatal, template, parameters, configureLog);
102102
}
103103
}
104104

@@ -114,7 +114,7 @@ private bool IsEnabled()
114114
return false;
115115
}
116116

117-
private void CaptureLog(LogSeverityLevel level, string template, object[]? parameters, Action<SentryLog>? configureLog)
117+
private void CaptureLog(SentryLogLevel level, string template, object[]? parameters, Action<SentryLog>? configureLog)
118118
{
119119
var timestamp = _clock.GetUtcNow();
120120

0 commit comments

Comments
 (0)