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
from contextlib import contextmanager
import enum
import logging
+import warnings
llog = logging.getLogger('pyi2ncommon.sysmisc')
# 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)