Design optional logforth-registry for configuration-driven logger lookup
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- rust
- Lĩnh vực
- observability
Hướng nghiên cứu
Không có tệp triển khai hoặc bài kiểm thử nào được nêu tên. Hãy bắt đầu bằng cách xem xét các thay đổi của global-logger trong #214 và ranh giới của logforth-core, sau đó so sánh các tài liệu tham chiếu về cấu hình của Log4j và Logback được liên kết trong issue. Công việc được xem là hoàn tất khi API của registry crate, mô hình selector, định dạng cấu hình, hành vi caching và ranh giới core đã được thống nhất trước khi bắt đầu triển khai.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Log4j 2 configuration supports config files,
Rootlogger configuration, namedLoggerentries, appenders, filters, and logger hierarchy concepts: - Logback configuration uses
<logger>and<root>elements, appender references, and root fallback semantics:
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-registryexpose only explicitRegistryvalues, 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
serdedata structures? - Should registry entries build full
Loggervalues 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
logbridge and any future tracing-style bridge? - What belongs in
logforth-coreas 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.
- Ngôn ngữ chính
- Rust
- Star
- 238
- Fork
- 31
- Merge trung bình
- 3 giờ 4 phút
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fast/logforth
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Add log macros as APIs Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Roadmap to 1.0 Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của fast/logforth
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
bug core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW Đang mởfuzz
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ClickHouse/ClickHouse#122114 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
linebender/vello_svg#90 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100