-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Situation
This issue proposes to move the application's logging configuration from its hard-coded, programmatic approach in src/docbuild/logging.py to the user's config.toml file.
Currently, a user cannot easily modify the logging behavior, such as changing the file's log level or output format, without editing the source code. This is not user-friendly and violates the principle of externalizing configuration.
Possible Solution
The logging configuration will be read from the config.toml file at application startup. The setup_logging function is already capable of handling a dictionary-based configuration, so the main task is to update the application's entry point to read a new [logging] table from the configuration file and pass it to setup_logging.
Furthermore, if the user doesn't provide a configuration file, the script should use a minimal, hard-coded configuration.
Related Issue:
Use Case
- Users can customise logging to their needs without changing the source code.
- All application settings, including logging, will be in a single file.
- The core logging logic can remain stable, while configuration can be changed and managed externally.
Possible Implementation
Example config.toml: A user should be able to configure their logging with a table like this:
[logging]
level = "DEBUG"
[logging.handlers]
console = { level = "INFO", formatter = "standard" }
file = { level = "DEBUG" }