Deprecate logging helpers in sysmisc
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 4 Mar 2026 12:40:55 +0000 (13:40 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 4 Mar 2026 12:48:27 +0000 (13:48 +0100)
Only real user of this feature (QA) is replacing it, so prepare removal
and help finding the remaining users.

src/sysmisc.py

index 12c7f82..335aa5d 100644 (file)
@@ -71,7 +71,7 @@ The library exports the symbols below and some custom logging functions.
         A context manager that temporarily changes the current working directory
 
 The logging functions either use the format capability or play
-the simple role of providing shorter names.
+the simple role of providing shorter names (which is now deprecated).
 """
 import re
 import subprocess
@@ -84,6 +84,7 @@ import uuid
 from contextlib import contextmanager
 import enum
 import logging
+import warnings
 llog = logging.getLogger('pyi2ncommon.sysmisc')
 
 
@@ -469,27 +470,37 @@ def progress(fmt, *args):
 # these methods serve as shorter names
 def inf(fmt, *args):
     """Short name for INFO logging."""
+    warnings.warn("Please replace usage of logging helpers in pyi2ncommon.sysmisc.",
+                  DeprecationWarning, stacklevel=2)
     llog.info(fmt, *args)
 
 
 def dbg(fmt, *args):
     """Short name for DEBUG logging."""
+    warnings.warn("Please replace usage of logging helpers in pyi2ncommon.sysmisc.",
+                  DeprecationWarning, stacklevel=2)
     llog.debug(fmt, *args)
 
 
 def err(fmt, *args):
     """Short name for ERROR logging."""
+    warnings.warn("Please replace usage of logging helpers in pyi2ncommon.sysmisc.",
+                  DeprecationWarning, stacklevel=2)
     llog.error(fmt, *args)
 
 
 def wrn(fmt, *args):
     """Short name for WARN logging."""
+    warnings.warn("Please replace usage of logging helpers in pyi2ncommon.sysmisc.",
+                  DeprecationWarning, stacklevel=2)
     llog.warning(fmt, *args)
 
 
 # these methods use the format capability
 def log(level, text, *args, **kwargs):
     """Log at any level using format capability."""
+    warnings.warn("Please replace usage of logging helpers in pyi2ncommon.sysmisc.",
+                  DeprecationWarning, stacklevel=3)
     llog.log(level, text.format(*args), **kwargs)