Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Design optional logforth-registry for configuration-driven logger lookup

Abierto
#225 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
rust

Línea de trabajo

No se mencionan archivos de implementación ni pruebas. Empieza revisando los cambios de global-logger en #214 y los límites de logforth-core; después, compara las referencias de configuración de Log4j y Logback enlazadas en el issue. Se considera terminado cuando la API del crate de registro, el modelo de selectores, el formato de configuración, el comportamiento de caché y el límite del core estén acordados antes de comenzar la implementación.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Rust
Estrellas
238
Forks
31
Merge medio
3 h 4 min
PR fusionados (30 d)
1

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de fast/logforth

Todos los issues de fast/logforth

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.