class_docstr: Helper to establish and control a Logger
class_docstr_tok: ["Helper","to","establish","and","control","a","Logger"]
docstr: Helper to set loglevel for an arbitrary logger
  
  By default operates for 'datalad'.
  TODO: deduce name from upper module name so it could be reused without changes
docstr_tok: ["Helper","to","set","loglevel","for","an","arbitrary","logger","By","default","operates","for","'datalad","'",".","TODO",":","deduce","name","from","upper","module","name","so","it","could","be","reused","without","changes"]
code: def set_level(self, level=None, default="INFO"):
      """Helper to set loglevel for an arbitrary logger
  
      By default operates for 'datalad'.
      TODO: deduce name from upper module name so it could be reused without changes
      """
      if level is None:
          # see if nothing in the environment
          level = self._get_config("level")
      if level is None:
          level = default
  
      try:
          # it might be a string which still represents an int
          log_level = int(level)
      except ValueError:
          # or a string which corresponds to a constant;)
          log_level = getattr(logging, level.upper())
  
      self.lgr.setLevel(log_level)
      # and set other related/used loggers to the same level to prevent their
      # talkativity, if they are not yet known to this python session, so we
      # have little chance to "override" possibly set outside levels
      for dep in ("git",):
          if dep not in logging.Logger.manager.loggerDict:
              logging.getLogger(dep).setLevel(log_level)
  
imports: from contextlib import contextmanager
  from functools import partial
  import inspect
  import logging
  import os
  import sys
  import platform
  import random
  import logging.handlers
  import warnings
  from os.path import basename, dirname
  from collections import defaultdict
  from .utils import is_interactive, optional_args
  from .support import ansi_colors
label_desc: Use image node_id 3 for calling the LoggerHelper obj's underlying member method code with example usage: obj.set_level(level, default) without return types