[elbe-devel] [PATCH 3/4] elbepack: log: manage special loggers centrally
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Aug 12 14:24:10 CEST 2024
There are various special loggers in elbe which are specially handled by
elbepack/log.py.
Instead of instantiating these loggers by hardcoded special values,
centrally create and import them from elbepack/log.py itself.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/dump.py | 5 +----
elbepack/elbeproject.py | 3 +--
elbepack/log.py | 2 ++
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/elbepack/dump.py b/elbepack/dump.py
index 0954eaa8912c..c97e863bbfec 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -3,7 +3,6 @@
# SPDX-FileCopyrightText: 2014-2017 Linutronix GmbH
import collections
-import logging
import pathlib
from datetime import datetime
from fnmatch import fnmatchcase
@@ -13,12 +12,10 @@ from apt import Cache
from elbepack.aptpkgutils import APTPackage, XMLPackage
from elbepack.archivedir import archive_tmpfile
from elbepack.finetuning import do_finetuning
+from elbepack.log import report, validation
from elbepack.shellhelper import do
from elbepack.version import elbe_version
-report = logging.getLogger('report')
-validation = logging.getLogger('validation')
-
def get_initvm_pkglist():
cache = Cache()
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index aad9a2f8d1c7..9dbfbc89cb54 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -25,6 +25,7 @@ from elbepack.efilesystem import TargetFs, extract_target
from elbepack.elbexml import ElbeXML, NoInitvmNode, ValidationError, ValidationMode
from elbepack.filesystem import size_to_int
from elbepack.finetuning import do_prj_finetuning
+from elbepack.log import validation
from elbepack.pbuilder import (
pbuilder_write_apt_conf,
pbuilder_write_config,
@@ -37,8 +38,6 @@ from elbepack.rpcaptcache import get_rpcaptcache
from elbepack.shellhelper import chroot, do
from elbepack.templates import write_pack_template
-validation = logging.getLogger('validation')
-
_xz_env = {
'XZ_OPT': '-T0 -M80%',
diff --git a/elbepack/log.py b/elbepack/log.py
index d296dbfdec88..ec62506990bc 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -18,6 +18,8 @@ context_fmt = logging.Formatter('%(context)s%(message)s')
msgonly_fmt = logging.Formatter('%(message)s')
log = logging.getLogger('log')
soap = logging.getLogger('soap')
+report = logging.getLogger('report')
+validation = logging.getLogger('validation')
class LoggingQueue(collections.deque):
--
2.46.0
More information about the elbe-devel
mailing list