Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Design optional logforth-registry for configuration-driven logger lookup

Aperta
#225 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
observability

Direzione di ricerca

Non sono indicati file di implementazione o test. Inizia esaminando le modifiche di global-logger in #214 e i confini di logforth-core, quindi confronta i riferimenti alla configurazione di Log4j e Logback collegati nell’issue. Il lavoro è completato quando l’API del crate di registry, il modello dei selettori, il formato di configurazione, il comportamento della cache e il confine del core sono concordati prima dell’inizio dell’implementazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Background

We are removing/rethinking the global default logger (#214). That keeps the core API explicit, but applications may still want a startup-provided, process-wide way to look up and reuse loggers without passing a Logger instance through every layer.

A future optional crate, tentatively named logforth-registry, could provide this capability. The idea is similar in spirit to OpenDAL-style registries: users provide a registry configuration, and application code can resolve a named/model/target-specific logger from that registry.

Goals

  • Provide an optional global registry that can be initialized at application startup.
  • Load logger definitions from a config file and/or programmatic registry settings.
  • Select loggers by dimensions such as target, module/logger name, app-defined model name, profile/tenant, or other selector settings.
  • Support a fallback root logger when no more specific logger matches.
  • Cache constructed logger instances in the registry so callers can reuse them without rebuilding pipelines or passing handles everywhere.
  • Support per-model/per-target logger relationships, including inheritance or fallback behavior where appropriate.
  • Keep this outside the core logger path so we do not recreate an implicit default global logger in logforth-core.

Prior art to study

These are not direct API models for Rust, but they are useful references for:

  • config-file shape and stability;
  • root logger fallback;
  • target/logger-name based selection;
  • appender/layout/filter references;
  • additivity/inheritance-like behavior;
  • runtime reload or replacement questions.

Sketch

A registry config might declare reusable appenders/layouts/filters, logger definitions, selector rules, and a root logger:

[root]
logger = "console"

[[loggers]]
name = "console"
selector.target = "*"
appenders = ["stdout"]

[[loggers]]
name = "model-a-file"
selector.model = "model-a"
selector.target = "my_crate::model_a::*"
appenders = ["rolling_file"]

The exact format is intentionally undecided. The important part is that the registry can map runtime lookup input to a cached logger instance:

let registry = logforth_registry::Registry::from_config(config)?;
logforth_registry::set_global(registry)?;

let logger = logforth_registry::get(LoggerSelector::new()
    .target("my_crate::model_a::worker")
    .setting("model", "model-a"));

Open questions

  • Should logforth-registry expose only explicit Registry values, or also provide a global singleton API?
  • What should the selector model look like: target/module path only, arbitrary key-value dimensions, typed dimensions, or a combination?
  • How should logger inheritance/additivity work, if at all?
  • What is the minimum useful config format: TOML, YAML, JSON, or format-agnostic serde data structures?
  • Should registry entries build full Logger values eagerly at startup, lazily on first lookup, or support both?
  • How should reload/reconfiguration work without surprising existing cached handles?
  • How should this interact with the log bridge and any future tracing-style bridge?
  • What belongs in logforth-core as reusable primitives, and what should remain in the optional registry crate?

Non-goals

  • Reintroducing a mandatory default global logger in core.
  • Making all applications configure logging through a registry.
  • Locking in a Log4j/Logback-compatible configuration syntax.
Lingua principale
Rust
Stelle
238
Fork
31
Merge medio
3h 4m
PR unite (30g)
1

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fast/logforth

Tutte le issue di fast/logforth

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.