Skip to content

refactor!: remove logforth core global logger#226

Merged
tisonkun merged 5 commits into
mainfrom
no-single-global-logger
May 25, 2026
Merged

refactor!: remove logforth core global logger#226
tisonkun merged 5 commits into
mainfrom
no-single-global-logger

Conversation

@tisonkun
Copy link
Copy Markdown
Contributor

@tisonkun tisonkun commented May 24, 2026

This closes #214

Signed-off-by: tison <wander4096@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the logforth_core “default/global logger” concept and shifts global log crate integration to explicit logforth-bridge-log adapter types (and logforth’s starter-log feature), updating examples, features, and docs accordingly.

Changes:

  • Removed core-level global logger APIs (default_logger, set_default_logger, LoggerBuilder::{apply, try_apply}) so LoggerBuilder only constructs Logger instances.
  • Refactored the log bridge to expose LogAdapter/OwnedLogAdapter/SharedLogAdapter and removed the previous global setup/try_setup helpers.
  • Updated starter_log to register the log crate’s global logger directly using OwnedLogAdapter, and adjusted examples/docs/features to match the new model.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
logforth/src/starter_log.rs Switches starter to install the log global logger via OwnedLogAdapter instead of relying on a core default logger.
logforth/src/lib.rs Removes re-exports of core global logger APIs and gates starter_log behind starter-log.
logforth/Cargo.toml Updates starter-log feature to include an optional log dependency.
examples/src/log_with_logger.rs Renames example usage from OwnedLogProxy to OwnedLogAdapter.
examples/src/asynchronous.rs Demonstrates keeping a logger handle (SharedLogAdapter) and registering it with log::set_boxed_logger.
examples/Cargo.toml Aligns example feature wiring with logforth/starter-log and updates required features for examples.
core/src/logger/mod.rs Drops re-exports of the removed global logger APIs.
core/src/logger/log_impl.rs Removes the OnceLock-backed default logger implementation.
core/src/logger/builder.rs Removes global-logger setup methods and updates doctests to use build().
CHANGELOG.md Updates breaking-change guidance to reflect “keep a logger handle” instead of using default_logger().flush().
bridges/log/src/lib.rs Replaces global setup with explicit adapter types (borrowed/owned/shared) and removes setup/try_setup.
appenders/syslog/src/lib.rs Updates docs to build a logger without relying on removed global logger APIs.
appenders/syslog/Cargo.toml Removes log dev-dependency (previously used by the docs/example path).
appenders/file/src/rolling.rs Updates rand trait import in tests (RngExt).
appenders/file/src/lib.rs Updates docs to build a logger without relying on removed global logger APIs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread appenders/file/src/lib.rs
Comment thread appenders/syslog/src/lib.rs
Comment thread core/src/logger/builder.rs
@tisonkun tisonkun force-pushed the no-single-global-logger branch 2 times, most recently from 0dede20 to 379428f Compare May 24, 2026 14:48
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun force-pushed the no-single-global-logger branch from 379428f to 3c60104 Compare May 24, 2026 14:51
tisonkun added 2 commits May 25, 2026 09:25
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun requested a review from Copilot May 25, 2026 03:24
@tisonkun tisonkun enabled auto-merge (squash) May 25, 2026 03:25
@tisonkun tisonkun disabled auto-merge May 25, 2026 03:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Comment thread core/src/logger/builder.rs Outdated
Comment thread logforth/src/starter_log.rs Outdated
Comment thread appenders/syslog/src/lib.rs
Comment thread appenders/file/src/lib.rs
Comment thread logforth/src/starter_log.rs Outdated
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun enabled auto-merge (squash) May 25, 2026 03:33
@tisonkun tisonkun merged commit 4b1a04f into main May 25, 2026
10 checks passed
@tisonkun tisonkun deleted the no-single-global-logger branch May 25, 2026 03:37
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.

Review global default logger

2 participants