25 lines
1.3 KiB
Markdown
25 lines
1.3 KiB
Markdown
# Python Logging Source References
|
|
|
|
Use these official Python docs when applying the Python logging skill.
|
|
|
|
## Core Documentation
|
|
|
|
!!! info "Core documentation"
|
|
- [Logging HOWTO](https://docs.python.org/3/howto/logging.html)
|
|
- [Logging Cookbook](https://docs.python.org/3/howto/logging-cookbook.html)
|
|
- [logging API reference](https://docs.python.org/3/library/logging.html)
|
|
- [logging.config reference](https://docs.python.org/3/library/logging.config.html)
|
|
|
|
## Configuration And dictConfig
|
|
|
|
!!! info "dictConfig references"
|
|
- [Dictionary schema details](https://docs.python.org/3/library/logging.config.html#logging-config-dictschema) for `version`, formatters, handlers, loggers, and root.
|
|
- [`logging.config.dictConfig`](https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig) function reference.
|
|
|
|
## Practical Notes
|
|
- Prefer module loggers created with `logging.getLogger(__name__)`.
|
|
- Let applications configure handlers and formatters; libraries should emit logs without taking over routing.
|
|
- Use `basicConfig` for simple scripts and `dictConfig` for centralized application configuration.
|
|
- Explicitly set `disable_existing_loggers: False` in `dictConfig` unless disabling existing non-root loggers is intentional.
|
|
- Use queue-based handlers when slow handlers would block async, threaded, or high-volume code paths.
|