Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 14bc609

Browse files
Upgrade Serilog + ensure logging is formatted as Traces instead of Events (#327)
1 parent f9bff5a commit 14bc609

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

src/NuGet.Services.Logging/LoggingSetup.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static LoggerConfiguration CreateDefaultLoggerConfiguration(bool withCons
2323

2424
if (withConsoleLogger)
2525
{
26-
loggerConfiguration = loggerConfiguration.WriteTo.ColoredConsole();
26+
loggerConfiguration = loggerConfiguration.WriteTo.Console();
2727
}
2828

2929
return loggerConfiguration;
@@ -40,19 +40,13 @@ public static ILoggerFactory CreateLoggerFactory(
4040
loggerConfiguration = CreateDefaultLoggerConfiguration();
4141
}
4242

43-
if (telemetryConfiguration != null
43+
if (telemetryConfiguration != null
4444
&& !string.IsNullOrEmpty(telemetryConfiguration.InstrumentationKey))
4545
{
46-
// Even though this method call is marked [Obsolete],
47-
// there's currently no other way to pass in the active TelemetryConfiguration as configured in DI.
48-
// These SeriLog APIs are very likely to change to support passing in the TelemetryConfiguration again.
49-
// See also https://github.com/serilog/serilog-sinks-applicationinsights/issues/121.
50-
51-
#pragma warning disable CS0618 // Type or member is obsolete
5246
loggerConfiguration = loggerConfiguration.WriteTo.ApplicationInsights(
53-
telemetryConfiguration,
47+
telemetryConfiguration,
48+
TelemetryConverter.Traces,
5449
applicationInsightsMinimumLogEventLevel);
55-
#pragma warning restore CS0618 // Type or member is obsolete
5650
}
5751

5852
Log.Logger = loggerConfiguration.CreateLogger();

src/NuGet.Services.Logging/NuGet.Services.Logging.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@
7878
<Version>10.0.2</Version>
7979
</PackageReference>
8080
<PackageReference Include="Serilog.Enrichers.Environment">
81-
<Version>2.1.0</Version>
81+
<Version>2.1.3</Version>
8282
</PackageReference>
8383
<PackageReference Include="Serilog.Enrichers.Process">
84-
<Version>2.0.0</Version>
84+
<Version>2.0.1</Version>
8585
</PackageReference>
8686
<PackageReference Include="Serilog.Extensions.Logging">
8787
<Version>3.0.1</Version>
8888
</PackageReference>
8989
<PackageReference Include="Serilog.Sinks.ApplicationInsights">
90-
<Version>2.2.1</Version>
90+
<Version>3.0.4</Version>
9191
</PackageReference>
92-
<PackageReference Include="Serilog.Sinks.ColoredConsole">
93-
<Version>2.0.0</Version>
92+
<PackageReference Include="Serilog.Sinks.Console">
93+
<Version>3.1.1</Version>
9494
</PackageReference>
9595
<PackageReference Include="SerilogTraceListener">
96-
<Version>2.0.10027</Version>
96+
<Version>3.2.0</Version>
9797
</PackageReference>
9898
<PackageReference Include="NuGet.Build.Tasks.Pack">
9999
<Version>4.8.0</Version>

0 commit comments

Comments
 (0)