Skip to content

Add log level option for unit test#321

Open
aurora0x27 wants to merge 1 commit intoclice-io:mainfrom
aurora0x27:ut-log-level
Open

Add log level option for unit test#321
aurora0x27 wants to merge 1 commit intoclice-io:mainfrom
aurora0x27:ut-log-level

Conversation

@aurora0x27
Copy link
Copy Markdown
Contributor

@aurora0x27 aurora0x27 commented Dec 10, 2025

Summary by CodeRabbit

  • New Features
    • Added command-line option to configure log-level with trace, debug, info, warn, error, and off levels (defaults to info).

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 10, 2025

Walkthrough

Adds a new command-line option log-level to unit_tests.cc that accepts trace, debug, info, warn, error, or off values with a default of info. The parsed option is wired into logging::options.level before stderr logger initialization without additional logic changes.

Changes

Cohort / File(s) Summary
Logging configuration option
bin/unit_tests.cc
Added log-level command-line option with support for trace, debug, info, warn, error, and off values; integrated into logging::options.level initialization

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A log-level hop, from trace to info's glow,
Command-line whispers tell loggers where to go,
Off, warn, or debug—the choice is now ours,
Unit tests shine brighter through configuration's doors! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add log level option for unit test' directly and accurately describes the main change: adding a log-level command-line option to the unit test binary.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
bin/unit_tests.cc (1)

38-49: Align log-level help text with supported values

off is accepted via clEnumValN(logging::Level::off, "off", "") but not mentioned in cl::value_desc("trace|debug|info|warn|error"). Consider adding |off there (and optionally mentioning it in the description) so the CLI help fully reflects all allowed values.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cec13ec and 1553560.

📒 Files selected for processing (1)
  • bin/unit_tests.cc (1 hunks)
🔇 Additional comments (1)
bin/unit_tests.cc (1)

58-59: Log level wiring into logger options looks correct

Assigning logging::options.level = log_level; immediately before logging::stderr_logger("clice", logging::options); cleanly applies the CLI-selected level to this executable’s logging without other side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant