Skip to content

Conversation

@PakhomovAlexander
Copy link
Collaborator

Summary

  • Add LogLevelHandle struct that enables changing log level at runtime without service restart
  • Uses tracing_subscriber::reload to wrap EnvFilter and provide dynamic reconfiguration
  • Setup functions now return LogLevelHandle (or tuple with existing return values for error_aggregation feature)

Usage

// Capture handle at initialization
let handle = setup_logs_with_rotation(LogLevel::Info, None, LogRotation::HOURLY)?;

// Later, change level at runtime
handle.set_level(LogLevel::Debug)?;

API Changes

  • setup_logs_with_rotation returns:
    • Without error_aggregation: LogLevelHandle
    • With error_aggregation: (LogLevelHandle, Arc<ErrorAggregationContainer>)
  • Same pattern for setup_logs and setup_logs_without_rotation

Test plan

  • All existing tests pass
  • Clippy passes with -D warnings
  • Builds with all feature combinations

🤖 Generated with Claude Code

@PakhomovAlexander PakhomovAlexander force-pushed the runtime-log-level-change branch 2 times, most recently from 8cc35bf to 02f06ec Compare January 13, 2026 11:18
@PakhomovAlexander PakhomovAlexander marked this pull request as draft January 13, 2026 11:25
Add LogLevelHandle that allows changing log level at runtime without
service restart using tracing_subscriber::reload.

- Add LogLevelHandle struct with set_level() method
- Update setup_logs_with_rotation to return LogLevelHandle
- Update all setup_logs variants to return the handle
- Fix pre-existing clippy warnings (type complexity, format strings)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@PakhomovAlexander PakhomovAlexander marked this pull request as ready for review January 13, 2026 11:45
.collect::<eyre::Result<_>>()?;

for (i, (reloader, filter)) in self.reloaders.iter().zip(filters).enumerate() {
reloader(filter).map_err(|e| eyre::eyre!("Failed to reload filter {i}: {e}"))?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The only issue I see is this, like we can have situation when one layer is updated and second errored. Maybe it's correct way to have retry/rollback but I think it could be some overkill for this

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.

3 participants