Skip to content

fix: Guard expensive argument evaluation when logging#1702

Merged
HofmeisterAn merged 1 commit into
developfrom
bugfix/logging-avoid-expensive-eval
Jun 13, 2026
Merged

fix: Guard expensive argument evaluation when logging#1702
HofmeisterAn merged 1 commit into
developfrom
bugfix/logging-avoid-expensive-eval

Conversation

@HofmeisterAn

@HofmeisterAn HofmeisterAn commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

-

Why is it important?

-

Related issues

-

Summary by CodeRabbit

  • Chores

    • Updated test and MongoDB dependencies to latest versions.
  • Refactor

    • Optimized logging performance by reducing unnecessary processing.

@HofmeisterAn HofmeisterAn added the chore A change that doesn't impact the existing functionality, e.g. internal refactorings or cleanups label Jun 13, 2026
@netlify

netlify Bot commented Jun 13, 2026

Copy link
Copy Markdown

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit f42b857
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/6a2ce45f8ac4a6000862f942
😎 Deploy Preview https://deploy-preview-1702--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 66d2f7fc-b417-4e39-b258-309c096950de

📥 Commits

Reviewing files that changed from the base of the PR and between 42bddd0 and f42b857.

📒 Files selected for processing (2)
  • Directory.Packages.props
  • src/Testcontainers/Logging.cs

Walkthrough

This PR updates three NuGet package versions in the centralized package configuration and adds a performance optimization to the Docker logging utility. The dependency updates include test SDK, database access, and MongoDB driver libraries; the logging change introduces an early exit guard to skip unnecessary work when logging is disabled.

Changes

Maintenance Updates

Layer / File(s) Summary
Dependency version updates
Directory.Packages.props
Centralized NuGet packages bumped: Microsoft.NET.Test.Sdk from 18.0.1 to 18.6.0, Dapper from 2.1.66 to 2.1.79, and MongoDB.Driver from 3.8.1 to 3.9.0.
Logging performance optimization
src/Testcontainers/Logging.cs
ExecuteCommandInDockerContainer now returns early if ILogger is not enabled for LogLevel.Information, preventing unnecessary command string joining and method execution.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 With versions bumped and guards in place,
We skip the logs that take no space—
Swift hops through MongoDB's newer halls,
While tests now fly through faster calls.
Small tweaks that make the framework fly! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is almost entirely empty, with all mandatory and recommended sections left unfilled or marked with dashes, failing to explain the what, why, or how of the changes. Fill in all mandatory sections: explain what changes were made (package updates and logging guard), why this matters (performance optimization), and how to test the changes. Link any related issues.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: guarding expensive argument evaluation when logging, which aligns with the code changes that add an early exit check for log level.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/logging-avoid-expensive-eval

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HofmeisterAn
HofmeisterAn merged commit b145ae1 into develop Jun 13, 2026
154 checks passed
@HofmeisterAn
HofmeisterAn deleted the bugfix/logging-avoid-expensive-eval branch June 13, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore A change that doesn't impact the existing functionality, e.g. internal refactorings or cleanups

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant