diff options
| author | 2022-03-04 22:28:57 -0500 | |
|---|---|---|
| committer | 2022-03-05 11:23:41 -0500 | |
| commit | 4920515c5a8e43ef9ca444254d1276058fcfa971 (patch) | |
| tree | 16948a48c841ed4e070092fb2804ac46acdad8f3 | |
| parent | Merge pull request #35 from python-discord/monkey-patch-in-util-namespace (diff) | |
fix: Set the logger class in botcore.utils.logging.py to the CustomLogger class
Fixes an issue when using trace logging on loggers that were instantiated before the class was set.
| -rw-r--r-- | CHANGELOG.md | 5 | ||||
| -rw-r--r-- | botcore/utils/logging.py | 6 | ||||
| -rw-r--r-- | pyproject.toml | 2 | 
3 files changed, 11 insertions, 2 deletions
| diff --git a/CHANGELOG.md b/CHANGELOG.md index 09287fc4..fe0ea33e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@  # Changelog -## 3.0.0 3rd March 2021 +## 3.0.1 5th March 2022 +- Fix: Setup log tracing when `botcore.utils.logging` is imported so that it can be used within botcore functions. + +## 3.0.0 3rd March 2022   - Breaking: Move `apply_monkey_patches()` directly to `botcore.utils` namespace  ## 2.1.0 24th February 2022 diff --git a/botcore/utils/logging.py b/botcore/utils/logging.py index 71ce4e66..1f1c8bac 100644 --- a/botcore/utils/logging.py +++ b/botcore/utils/logging.py @@ -43,3 +43,9 @@ def get_logger(name: typing.Optional[str] = None) -> CustomLogger:          An instance of the :obj:`CustomLogger` class.      """      return typing.cast(CustomLogger, logging.getLogger(name)) + + +# Setup trace level logging so that we can use it within botcore. +logging.TRACE = TRACE_LEVEL +logging.setLoggerClass(CustomLogger) +logging.addLevelName(TRACE_LEVEL, "TRACE") diff --git a/pyproject.toml b/pyproject.toml index 188edb8f..554948e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@  [tool.poetry]  name = "bot-core" -version = "3.0.0" +version = "3.0.1"  description = "Bot-Core provides the core functionality and utilities for the bots of the Python Discord community."  authors = ["Python Discord <[email protected]>"]  license = "MIT" | 
