Skip to content

deps: Remove Serilog.Extensions.Logging#433

Merged
DennisDyallo merged 3 commits intodevelopfrom
dependabot/nuget/Yubico.YubiKey/tests/integration/multi-bb9bb716c0
Mar 23, 2026
Merged

deps: Remove Serilog.Extensions.Logging#433
DennisDyallo merged 3 commits intodevelopfrom
dependabot/nuget/Yubico.YubiKey/tests/integration/multi-bb9bb716c0

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot bot commented on behalf of github Mar 18, 2026

Updated Serilog.Extensions.Logging from 9.0.2 to 10.0.0.

Release notes

Sourced from Serilog.Extensions.Logging's releases.

10.0.0

What's Changed

Full Changelog: serilog/serilog-extensions-logging@v9.0.2...v10.0.0

Commits viewable in compare view.

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

---
updated-dependencies:
- dependency-name: Serilog.Extensions.Logging
  dependency-version: 10.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: Serilog.Extensions.Logging
  dependency-version: 10.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added .NET Pull requests that update .NET code dependencies Pull requests that update a dependency file labels Mar 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Test Results: Windows

    2 files      2 suites   16s ⏱️
4 052 tests 4 033 ✅ 19 💤 0 ❌
4 054 runs  4 035 ✅ 19 💤 0 ❌

Results for commit e904873.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Test Results: Ubuntu

    2 files      2 suites   50s ⏱️
4 044 tests 4 025 ✅ 19 💤 0 ❌
4 046 runs  4 027 ✅ 19 💤 0 ❌

Results for commit e904873.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 18, 2026

Test Results: MacOS

    4 files      4 suites   29s ⏱️
4 026 tests 4 026 ✅ 0 💤 0 ❌
4 028 runs  4 028 ✅ 0 💤 0 ❌

Results for commit e904873.

♻️ This comment has been updated with latest results.

@DennisDyallo
Copy link
Copy Markdown
Collaborator

@claude See if you can easily remove Serilog from the project. I think it's only being used in some integration tests or example apps. Plan for this, then Show me the plan.

@claude
Copy link
Copy Markdown

claude bot commented Mar 19, 2026

Claude finished @DennisDyallo's task in 12m 3s —— View job


Serilog Removal Plan

  • Gather context and understand the request
  • Search for all Serilog usages across the codebase
  • Analyze what Serilog is used for and what would replace it
  • Create a removal plan

Findings

Serilog appears in 4 locations across 2 project types — integration tests and a sandbox test app. It does not appear in any production/public code. The core library (Yubico.Core, Yubico.YubiKey) has no Serilog dependency.

NuGet packages (in 2 .csproj files):

Both IntegrationTests.csproj and TestApp.csproj reference all three of these packages:

Serilog 4.3.1
Serilog.Extensions.Logging 10.0.0
Serilog.Sinks.Console 6.1.1

Note: Microsoft.Extensions.Logging.Console is already present in both projects.

Code usage (in 2 .cs files):

File What Serilog does
tests/integration/Yubico/YubiKey/ReclaimTimeoutTests.cs Sets up a console logger with microsecond timestamps (HH:mm:ss.fffffff) and thread ID enrichment for diagnostic output during a transport-switching test
tests/sandbox/Plugins/EventManagerPlugin.cs Sets up a console logger with thread ID enrichment to watch YubiKey arrival/removal events

Documentation only (no dependency):

  • Yubico.Core/src/Yubico/Core/Logging/Log.cs — XML doc comments use Serilog as a usage example
  • Yubico.Core/src/Yubico/Core/Logging/Logger.Legacy.cs — mentions Serilog in remarks

Removal Plan

Step 1 — Remove Serilog packages from both .csproj files

Remove from Yubico.YubiKey/tests/integration/Yubico.YubiKey.IntegrationTests.csproj:

- <PackageReference Include="Serilog" Version="4.3.1" />
- <PackageReference Include="Serilog.Extensions.Logging" Version="10.0.0" />
- <PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />

Same 3 removals in Yubico.YubiKey/tests/sandbox/Yubico.YubiKey.TestApp.csproj.

Step 2 — Rewrite ReclaimTimeoutTests.cs

The Serilog setup here is purely diagnostic (not part of any assertion). Replace with the built-in AddSimpleConsole which already supports timestamp formatting:

- using Serilog;
- using Serilog.Core;
- using Serilog.Events;
- using Logger = Serilog.Core.Logger;

- class ThreadIdEnricher : ILogEventEnricher
- {
-     public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
-     {
-         logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
-             "ThreadId", Environment.CurrentManagedThreadId));
-     }
- }

  // Inside the test method:
- using Logger? log = new LoggerConfiguration()
-     .Enrich.With(new ThreadIdEnricher())
-     .WriteTo.Console(outputTemplate: "{Timestamp:HH:mm:ss.fffffff} [{Level}] ({ThreadId})  {Message}{NewLine}{Exception}")
-     .CreateLogger();
  Log.ConfigureLoggerFactory(builder =>
      builder
          .ClearProviders()
-         .AddSerilog(log)
+         .AddSimpleConsole(opts => opts.TimestampFormat = "HH:mm:ss.fffffff ")
          .AddFilter(level => level >= LogLevel.Information));

Trade-off: Thread ID will no longer appear in log output. This is acceptable since it's only diagnostic output — the test assertions rely on Stopwatch timings, not log content.

Step 3 — Rewrite EventManagerPlugin.cs

Same pattern — replace the Serilog setup with the built-in console logger:

- using Serilog;
- using Serilog.Core;
- using Serilog.Events;
- using Logger = Serilog.Core.Logger;

- class ThreadIdEnricher : ILogEventEnricher
- {
-     public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
-     {
-         logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
-             "ThreadId", Environment.CurrentManagedThreadId));
-     }
- }

  // Inside Execute():
- using Logger? log = new LoggerConfiguration()
-     .Enrich.With(new ThreadIdEnricher())
-     .WriteTo.Console(outputTemplate: "[{Level}] ({ThreadId})  {Message}{NewLine}{Exception}")
-     .CreateLogger();
  Log.ConfigureLoggerFactory(builder =>
-     builder
-         .AddSerilog(log)
-         .AddFilter(level => level >= LogLevel.Information));
+     builder
+         .AddSimpleConsole()
+         .AddFilter(level => level >= LogLevel.Information));

Step 4 (Optional) — Update XML doc in Log.cs

Yubico.Core/src/Yubico/Core/Logging/Log.cs lines 58–62 use Serilog as a doc example. Since Serilog is a valid third-party provider for Microsoft.Extensions.Logging, it's reasonable to keep this as an example or replace it with a different provider (e.g., AddEventLog). This is cosmetic only — no build impact.


Summary

Item Effort Notes
Remove 6 NuGet package references Trivial 3 packages × 2 projects
Rewrite logging in ReclaimTimeoutTests.cs Easy ~15 line reduction, lose ThreadId in format
Rewrite logging in EventManagerPlugin.cs Easy ~15 line reduction, lose ThreadId in format
Update XML docs in Log.cs Optional No build impact

This is easily doable. All required infrastructure (Microsoft.Extensions.Logging.Console) is already present in both projects. The only functional change is losing thread ID from the log output format, which has no impact on test correctness.

@DennisDyallo
Copy link
Copy Markdown
Collaborator

@claude Serilog Removal Plan: Do it.

@claude
Copy link
Copy Markdown

claude bot commented Mar 19, 2026

Claude finished @DennisDyallo's task in 1m 51s —— View job


Serilog Removal Complete

  • Gather context and understand the request
  • Read all affected files
  • Remove Serilog packages from IntegrationTests.csproj
  • Remove Serilog packages from TestApp.csproj
  • Rewrite ReclaimTimeoutTests.cs to use AddSimpleConsole
  • Rewrite EventManagerPlugin.cs to use AddSimpleConsole
  • Commit and push changes

Removed all 3 Serilog packages (Serilog, Serilog.Extensions.Logging, Serilog.Sinks.Console) from both project files and replaced the Serilog logger setup in both .cs files with the built-in AddSimpleConsole. The ThreadIdEnricher helper classes were deleted as they are no longer needed. Net result: 46 lines removed, 3 added.

Note: Thread IDs no longer appear in the log output, but this has no impact on test correctness — the ReclaimTimeoutTests assertions rely on Stopwatch timings, not log content.
|

github-actions bot and others added 2 commits March 19, 2026 16:23
Replace Serilog with the built-in AddSimpleConsole from
Microsoft.Extensions.Logging.Console, which is already referenced
in both projects. Removes 3 NuGet packages (Serilog,
Serilog.Extensions.Logging, Serilog.Sinks.Console) from both
IntegrationTests.csproj and TestApp.csproj.

Co-authored-by: Dennis Dyallo <DennisDyallo@users.noreply.github.com>
@DennisDyallo DennisDyallo changed the title Bump Serilog.Extensions.Logging from 9.0.2 to 10.0.0 deps: Remove Serilog.Extensions.Logging Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
Yubico.Core 45% 35% 4557
Yubico.YubiKey 50% 46% 21540
Summary 49% (37353 / 76329) 44% (8990 / 20562) 26097

Minimum allowed line rate is 40%

@DennisDyallo DennisDyallo merged commit 3b0bf41 into develop Mar 23, 2026
15 checks passed
@DennisDyallo DennisDyallo deleted the dependabot/nuget/Yubico.YubiKey/tests/integration/multi-bb9bb716c0 branch March 23, 2026 18:05
@DennisDyallo DennisDyallo mentioned this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file .NET Pull requests that update .NET code

Development

Successfully merging this pull request may close these issues.

1 participant