From 26dbf2da3f13c0b3e10b73981a0e7267911151ff Mon Sep 17 00:00:00 2001 From: Greg Albrecht Date: Fri, 1 Mar 2024 16:43:16 -0800 Subject: [PATCH] 6.3.1 Fixes #67: Logging improvements. --- CHANGELOG.md | 4 ++++ pytak/__init__.py | 2 +- pytak/constants.py | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64d92e8..89c8a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## PyTAK 6.3.1 + +- Fixes #67: Add constrained logging for systemd invocation. + ## PyTAK 6.3.0 - Fixes #58: TypeError: can't multiply sequence by non-int of type 'float'. diff --git a/pytak/__init__.py b/pytak/__init__.py index 8a665ee..4b7ef4e 100644 --- a/pytak/__init__.py +++ b/pytak/__init__.py @@ -19,7 +19,7 @@ :source: """ -__version__ = "6.3.0" +__version__ = "6.3.1" from .constants import ( # NOQA diff --git a/pytak/constants.py b/pytak/constants.py index 5aadd27..104bace 100644 --- a/pytak/constants.py +++ b/pytak/constants.py @@ -33,6 +33,11 @@ ("%(asctime)s pytak %(levelname)s - %(message)s") ) +if os.environ.get("INVOCATION_ID"): + LOG_LEVEL = logging.INFO + LOG_FORMAT = logging.Formatter(("[%(levelname)s] %(message)s")) + logging.debug("Systemd format logging enabled via INVOCATION_ID env var.") + if bool(os.environ.get("DEBUG")): LOG_LEVEL = logging.DEBUG LOG_FORMAT = logging.Formatter(