Skip to content

Make Logging Configurable via config.toml #84

@sushant-suse

Description

@sushant-suse

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:

#55

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" }

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions