This is an automated email from the ASF dual-hosted git repository.
tn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new 26382e8 use rich handler for logging, enable debug messages for atr
in debug mode
26382e8 is described below
commit 26382e8df41169be835b362cc0b918c1b15bba89
Author: Thomas Neidhart <[email protected]>
AuthorDate: Tue Apr 1 17:27:36 2025 +0200
use rich handler for logging, enable debug messages for atr in debug mode
---
atr/server.py | 14 ++++++++++-
poetry.lock | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
pyproject.toml | 1 +
3 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/atr/server.py b/atr/server.py
index be9b6d1..bde1c19 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -30,8 +30,10 @@ import asfquart.session
import blockbuster
import quart
import quart_schema
+import rich.logging as rich_logging
import werkzeug.routing as routing
+import atr
import atr.blueprints as blueprints
import atr.config as config
import atr.db as db
@@ -177,12 +179,22 @@ def app_setup_lifecycle(app: base.QuartApp) -> None:
def app_setup_logging(app: base.QuartApp, config_mode: config.Mode,
app_config: type[config.AppConfig]) -> None:
"""Setup application logging."""
+
+ # remove any existing handlers, hypercorn might have set them up already
+ for handler in logging.root.handlers:
+ logging.root.removeHandler(handler)
+
logging.basicConfig(
- format="[%(asctime)s.%(msecs)03d ] [%(process)d] [%(levelname)s]
%(message)s",
+ format="[%(asctime)s.%(msecs)03d ] [%(process)d] %(message)s",
level=logging.INFO,
datefmt="%Y-%m-%d %H:%M:%S",
+ handlers=[rich_logging.RichHandler(rich_tracebacks=True,
show_time=False)],
)
+ # enable debug output for atr.* in DEBUG mode
+ if config_mode == config.Mode.Debug:
+ logging.getLogger(atr.__name__).setLevel(logging.DEBUG)
+
# Only log in the worker process
@app.before_serving
async def log_debug_info() -> None:
diff --git a/poetry.lock b/poetry.lock
index 49ce804..d95291e 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1342,6 +1342,31 @@ babel = ["Babel"]
lingua = ["lingua"]
testing = ["pytest"]
+[[package]]
+name = "markdown-it-py"
+version = "3.0.0"
+description = "Python port of markdown-it. Markdown parsing, done right!"
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+files = [
+ {file = "markdown-it-py-3.0.0.tar.gz", hash =
"sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"},
+ {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash =
"sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"},
+]
+
+[package.dependencies]
+mdurl = ">=0.1,<1.0"
+
+[package.extras]
+benchmarking = ["psutil", "pytest", "pytest-benchmark"]
+code-style = ["pre-commit (>=3.0,<4.0)"]
+compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe
(>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"]
+linkify = ["linkify-it-py (>=1,<3)"]
+plugins = ["mdit-py-plugins"]
+profiling = ["gprof2dot"]
+rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx",
"sphinx-copybutton", "sphinx-design", "sphinx_book_theme"]
+testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"]
+
[[package]]
name = "markupsafe"
version = "3.0.2"
@@ -1413,6 +1438,18 @@ files = [
{file = "markupsafe-3.0.2.tar.gz", hash =
"sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"},
]
+[[package]]
+name = "mdurl"
+version = "0.1.2"
+description = "Markdown URL utilities"
+optional = false
+python-versions = ">=3.7"
+groups = ["main"]
+files = [
+ {file = "mdurl-0.1.2-py3-none-any.whl", hash =
"sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},
+ {file = "mdurl-0.1.2.tar.gz", hash =
"sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
+]
+
[[package]]
name = "multidict"
version = "6.1.0"
@@ -1934,6 +1971,21 @@ files = [
[package.dependencies]
typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0"
+[[package]]
+name = "pygments"
+version = "2.19.1"
+description = "Pygments is a syntax highlighting package written in Python."
+optional = false
+python-versions = ">=3.8"
+groups = ["main"]
+files = [
+ {file = "pygments-2.19.1-py3-none-any.whl", hash =
"sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"},
+ {file = "pygments-2.19.1.tar.gz", hash =
"sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"},
+]
+
+[package.extras]
+windows-terminal = ["colorama (>=0.4.6)"]
+
[[package]]
name = "pyhumps"
version = "3.8.0"
@@ -2302,6 +2354,25 @@ urllib3 = ">=1.21.1,<3"
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
+[[package]]
+name = "rich"
+version = "14.0.0"
+description = "Render rich text, tables, progress bars, syntax highlighting,
markdown and more to the terminal"
+optional = false
+python-versions = ">=3.8.0"
+groups = ["main"]
+files = [
+ {file = "rich-14.0.0-py3-none-any.whl", hash =
"sha256:1c9491e1951aac09caffd42f448ee3d04e58923ffe14993f6e83068dc395d7e0"},
+ {file = "rich-14.0.0.tar.gz", hash =
"sha256:82f1bc23a6a21ebca4ae0c45af9bdbc492ed20231dcb63f297d6d1021a9d5725"},
+]
+
+[package.dependencies]
+markdown-it-py = ">=2.2.0"
+pygments = ">=2.13.0,<3.0.0"
+
+[package.extras]
+jupyter = ["ipywidgets (>=7.5.1,<9)"]
+
[[package]]
name = "ruff"
version = "0.11.0"
@@ -2786,4 +2857,4 @@ propcache = ">=0.2.0"
[metadata]
lock-version = "2.1"
python-versions = "~=3.13"
-content-hash =
"19419e871975d018df394bc852c0a913a8f7a5bcc867e795a2f177a668e5cf4c"
+content-hash =
"2ef634e616459d2ddf8e7cb0be445224c0fc56f67373c109b8087a8380b4a3ba"
diff --git a/pyproject.toml b/pyproject.toml
index d0e6060..3eb193e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -29,6 +29,7 @@ dependencies = [
"python-gnupg~=0.5",
"quart-schema[pydantic]~=0.21",
"quart-wtforms~=1.0.3",
+ "rich~=14.0.0",
"sqlmodel~=0.0.24",
]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]