Commit 87378db80cf44da06be9b5c6c63b4e95c771f2ff

Authored by Christian Herdtweck
1 parent 1e920d61

log_helper: provide logging.NOTSET

This constant is needed for enable_logging() functions. It is the
only reason for `import logging` in common-logging-enabled modules.
Easier to provide it in log_helper
oletools/common/log_helper/log_helper.py
... ... @@ -62,11 +62,19 @@ LOG_LEVELS = {
62 62 'critical': logging.CRITICAL
63 63 }
64 64  
  65 +#: provide this constant to modules, so they do not have to import
  66 +#: :py:mod:`logging` for themselves just for this one constant.
  67 +NOTSET = logging.NOTSET
  68 +
65 69 DEFAULT_LOGGER_NAME = 'oletools'
66 70 DEFAULT_MESSAGE_FORMAT = '%(levelname)-8s %(message)s'
67 71  
68 72  
69 73 class LogHelper:
  74 +
  75 + #: for convenience: here again (see also :py:data:`log_helper.NOTSET`)
  76 + NOTSET = logging.NOTSET
  77 +
70 78 def __init__(self):
71 79 self._all_names = set() # set so we do not have duplicates
72 80 self._use_json = False
... ...