Skip to content

Conversation

@snakefoot
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Sep 28, 2025

Warning

Rate limit exceeded

@snakefoot has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 54 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f0c9bcc and 5a89518.

📒 Files selected for processing (1)
  • src/NLog/Config/LoggingRule.cs (7 hunks)

Walkthrough

Uniformizes level enabling/disabling in LoggingRule: constructors now always call EnableLoggingForLevels; Enable/Disable methods add null guards and early-return when minLevel is Off; SetLoggingLevels now resets filter to Off before re-enabling the specified range. Guard checks adjusted; control flow centralized through EnableLoggingForLevels.

Changes

Cohort / File(s) Summary
Logging level handling refactor
src/NLog/Config/LoggingRule.cs
Constructors always call EnableLoggingForLevels; single-target constructor enables to MaxLevel. Enable/DisableLoggingForLevel add null guards post-Off check. Enable/DisableLoggingForLevels early-return on Off. SetLoggingLevels now sets filter to Off, then calls EnableLoggingForLevels(min,max). Centralizes level range application and guard placement.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant LoggingRule
  participant LevelFilter as Internal Level Filter

  rect rgba(200,240,255,0.3)
    Note over Caller,LoggingRule: Construction path (changed)
    Caller->>LoggingRule: new LoggingRule(minLevel, maxLevel[, target])
    LoggingRule->>LevelFilter: set Off
    LoggingRule->>LoggingRule: EnableLoggingForLevels(minLevel, maxLevel)
    alt minLevel == Off
      LoggingRule-->>LoggingRule: early return (no levels enabled)
    else
      LoggingRule->>LevelFilter: enable range [minLevel..maxLevel]
    end
  end

  rect rgba(220,255,220,0.3)
    Note over Caller,LoggingRule: SetLoggingLevels (changed)
    Caller->>LoggingRule: SetLoggingLevels(minLevel, maxLevel)
    LoggingRule->>LevelFilter: set Off
    LoggingRule->>LoggingRule: EnableLoggingForLevels(minLevel, maxLevel)
    alt minLevel == Off
      LoggingRule-->>LoggingRule: early return
    else
      LoggingRule->>LevelFilter: enable range [minLevel..maxLevel]
    end
  end

  rect rgba(255,240,200,0.3)
    Note over Caller,LoggingRule: Per-level enable/disable (guards added)
    Caller->>LoggingRule: Enable/DisableLoggingForLevel(level)
    alt level == Off
      LoggingRule-->>Caller: no-op
    else
      LoggingRule->>LoggingRule: Guard.ThrowIfNull(level)
      LoggingRule->>LevelFilter: toggle level on/off
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit taps logs in a tidy row,
Flicks Off to reset, then lets levels flow.
Guards at the gates, nulls kept at bay,
Ranges enabled the streamlined way.
Thump-thump—control paths neat and true,
Burrow-ready, shipping anew! 🐇✨

Pre-merge checks and finishing touches and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request lacks any author-provided description, so there is no information that relates to or summarizes the changeset. Please add a brief description summarizing the purpose and scope of the changes to help reviewers understand the intent of this pull request.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the primary change, focusing on aligning EnableLoggingForLevels and DisableLoggingForLevels behavior around LogLevel.Off, which reflects the main intent of the modifications.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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.

@snakefoot snakefoot enabled auto-merge (squash) September 28, 2025 20:18
@snakefoot snakefoot changed the title LoggingRule - Align EnableLoggingForLevels and DisableLoggingForLevels to skip when minLevel == LogLevel.Off LoggingRule - Align EnableLoggingForLevels and DisableLoggingForLevels to skip when minLevel is LogLevel.Off Sep 28, 2025
@snakefoot snakefoot disabled auto-merge September 28, 2025 20:28
@snakefoot snakefoot enabled auto-merge (squash) September 28, 2025 20:28
@sonarqubecloud
Copy link

@snakefoot snakefoot merged commit c072d03 into NLog:dev Sep 28, 2025
6 checks passed
@snakefoot snakefoot added this to the 6.0.5 milestone Sep 30, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant