mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-28 02:42:21 +00:00
📝 consolidate logger API and async lifecycle guidance
This commit is contained in:
@@ -36,6 +36,9 @@ Detailed rules explaining key parameters and behaviors
|
||||
- Parsing is separated from runtime construction.
|
||||
- This API is ideal for validating, editing, or inspecting config values before calling `build_logger(...)`.
|
||||
- Supported keys are intentionally constrained to stable built-in sink shapes and formatter options.
|
||||
- Omitted top-level keys fall back to the same defaults used by the typed config constructors: `min_level=Info`, `target=""`, `timestamp=false`, `sink=default_sink_config()`, and `queue=None`.
|
||||
- When a `sink` object is present, parsing selects the built-in sink kind and validates sink-specific data before any runtime logger is built. In particular, `kind=File` requires a non-empty `path`.
|
||||
- `parse_and_build_logger(...)` is only this parser plus `build_logger(...)`, so using the two-step path here does not change the configured runtime pipeline.
|
||||
- The error surface is `ConfigError` rather than silent fallback behavior.
|
||||
|
||||
### How to Use
|
||||
@@ -73,6 +76,8 @@ e.g.:
|
||||
|
||||
- If supported fields have wrong types or unsupported enum text, parsing raises `ConfigError`.
|
||||
|
||||
- If `sink.kind` is `File` but `sink.path` is empty, parsing raises `ConfigError` before runtime construction.
|
||||
|
||||
### Notes
|
||||
|
||||
1. Prefer this API when you need typed config inspection before building.
|
||||
|
||||
Reference in New Issue
Block a user