Skip to content

feat(cmd): bridge slog level to the glog -v flag#3944

Open
rickstaa wants to merge 2 commits into
masterfrom
rs/slog-verbosity-bridge
Open

feat(cmd): bridge slog level to the glog -v flag#3944
rickstaa wants to merge 2 commits into
masterfrom
rs/slog-verbosity-bridge

Conversation

@rickstaa

@rickstaa rickstaa commented Jun 10, 2026

Copy link
Copy Markdown
Member

What

Enable slog Debug output at -v 6, so the existing glog verbosity flag also controls slog.

vFlag.Value.Set(*verbosity)   // glog verbosity goes live here
if glog.V(6) {                // ...read it here
    slog.SetLogLoggerLevel(slog.LevelDebug)
}

Why

go-livepeer uses two loggers: older code on glog (driven by -v), and newer subsystems (live runner registry, trickle/, ai/worker/, media/) on the stdlib log/slog. Nothing ever set slog's level, so it sat at Info and every slog.Debug line was dropped regardless of -v — no way to turn them on.

This bridges them: -v 6 (the documented max verbosity, already used via glog.V(6) for the deepest logging) now also enables slog Debug. Works because nothing calls slog.SetDefault, so the package-level slog.Debug/slog.Info calls flow through the default handler that SetLogLoggerLevel controls. The check runs right after vFlag.Value.Set(*verbosity), the line that applies -v to glog, so it reads the configured value.

Interim by design — the long-term direction is migrating off glog onto slog, at which point this goes away. For now it makes the newer slog code usable with the flag operators already know.

Checklist:

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes
    • Made debug logging consistent by mapping the existing verbose flag to the newer structured logging, so verbose mode enables debug output across updated subsystems.
  • Documentation
    • Added an Unreleased changelog note describing how verbose logging now controls newer subsystem debug messages.

slog (used by the live runner registry, trickle, ai/worker, and media) ran at
its default Info level with no way to enable Debug, so every slog.Debug line
was dropped regardless of -v. Enable slog Debug at -v 6 (the documented max
verbosity) so the existing flag also controls slog output.
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1409a5cb-ac98-4af6-8a98-a17c26156eec

📥 Commits

Reviewing files that changed from the base of the PR and between f7f5d0f and a1571aa.

📒 Files selected for processing (1)
  • CHANGELOG_PENDING.md
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG_PENDING.md

📝 Walkthrough

Walkthrough

cmd/livepeer/livepeer.go adds an import for Go's log/slog package and introduces a startup shim that bridges slog debug logging with the existing glog verbosity level, enabling slog debug output when glog.V(6) is active. A changelog entry documents this logging level mapping.

Changes

Logging Verbosity Bridge

Layer / File(s) Summary
slog/glog verbosity alignment
cmd/livepeer/livepeer.go, CHANGELOG_PENDING.md
slog package is imported and a conditional startup block aligns slog debug logging with glog verbosity: when glog.V(6) is enabled, slog logger level is set to slog.LevelDebug to prevent debug messages from newer subsystems using slog from being suppressed. Changelog documents the verbosity mapping to the glog -v flag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Poem

🐰 A bridge of logs, both old and new,
glog whispers secrets, slog joins the brew,
When verbosity rises to level six,
Debug messages dance, the logging mix! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: bridging slog logging level to the glog -v flag for unified verbosity control across both logging systems.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rs/slog-verbosity-bridge

Warning

Tools execution failed with the following error:

Failed to run tools: 14 UNAVAILABLE: read ECONNRESET


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.

@github-actions github-actions Bot added the go Pull requests that update Go code label Jun 10, 2026
@rickstaa rickstaa requested a review from j0sh June 10, 2026 14:36
@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

ENG-107

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.33175%. Comparing base (e628b9c) to head (a1571aa).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cmd/livepeer/livepeer.go 0.00000% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3944         +/-   ##
===================================================
+ Coverage   33.30014%   33.33175%   +0.03161%     
===================================================
  Files            171         171                 
  Lines          42174       42176          +2     
===================================================
+ Hits           14044       14058         +14     
+ Misses         27077       27064         -13     
- Partials        1053        1054          +1     
Files with missing lines Coverage Δ
cmd/livepeer/livepeer.go 0.00000% <0.00000%> (ø)

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e628b9c...a1571aa. Read the comment docs.

Files with missing lines Coverage Δ
cmd/livepeer/livepeer.go 0.00000% <0.00000%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant