class_docstr: Helper to establish and control a Logger
class_docstr_tok: ["Helper","to","establish","and","control","a","Logger"]
docstr: Initialize and return the logger
  
  Parameters
  ----------
  logtarget: {'stderr', str }, optional
    Where to direct the logs. 'stderr' stands for the standard stream.
    Any other string is considered a filename.  Multiple entries could be
    specified comma-separated
  
  Returns
  -------
  logging.Logger
docstr_tok: ["Initialize","and","return","the","logger","Parameters","--","--","--","--","--","logtarget",":","{","'stderr","'",",","str","}",",","optional","Where","to","direct","the","logs",".","'stderr","'","stands","for","the","standard","stream",".","Any","other","string","is","considered","a","filename",".","Multiple","entries","could","be","specified","comma-separated","Returns","--","--","--","-","logging.Logger"]
code: def get_initialized_logger(self, logtarget=None):
      """Initialize and return the logger
  
      Parameters
      ----------
      logtarget: {'stderr', str }, optional
        Where to direct the logs. 'stderr' stands for the standard stream.
        Any other string is considered a filename.  Multiple entries could be
        specified comma-separated
  
      Returns
      -------
      logging.Logger
      """
      if not logtarget:
          logtarget = self._get_config("target", "stderr")
  
      # Allow for multiple handlers being specified, comma-separated
      if "," in logtarget:
          for handler_ in logtarget.split(","):
              self.get_initialized_logger(logtarget=handler_)
          return self.lgr
  
      if logtarget.lower() == "stderr":
          loghandler = logging.StreamHandler(sys.stderr)
          use_color = is_interactive()  # explicitly decide here
      elif logtarget.lower() == "stdout":
          warnings.warn(
              "'stdout' was discontinued as valid log target and "
              "will be ignored.",
              DeprecationWarning,
          )
      else:
          # must be a simple filename
          # Use RotatingFileHandler for possible future parametrization to keep
          # log succinct and rotating
          loghandler = logging.handlers.RotatingFileHandler(logtarget)
          use_color = False
          # I had decided not to guard this call and just raise exception to go
          # out happen that specified file location is not writable etc.
  
      for names_filter in "names", "namesre":
          names = self._get_config(names_filter, "")
          if names:
              import re
  
              # add a filter which would catch those
              class LogFilter(object):
                  """A log filter to filter based on the log target name(s)"""
  
                  def __init__(self, names):
                      self.target_names = (
                          set(n for n in names.split(","))
                          if names_filter == "names"
                          else re.compile(names)
                      )
  
                  if names_filter == "names":
  
                      def filter(self, record):
                          return record.name in self.target_names
  
                  else:
  
                      def filter(self, record):
                          return self.target_names.match(record.name)
  
              loghandler.addFilter(LogFilter(names))
  
      # But now improve with colors and useful information such as time
      loghandler.setFormatter(
          ColorFormatter(
              use_color=use_color,
              # TODO: config log.name, pid
              log_name=self._get_config("name", False),
              log_pid=self._get_config("pid", False),
          )
      )
      #  logging.Formatter('%(asctime)-15s %(levelname)-6s %(message)s'))
      if is_interactive():
          phandler = ProgressHandler(other_handler=loghandler)
          phandler.filters.extend(loghandler.filters)
          self.lgr.addHandler(phandler)
      else:
          loghandler.addFilter(
              partial(filter_noninteractive_progress, self.lgr)
          )
          self.lgr.addHandler(loghandler)
  
      self.set_level()  # set default logging level
      return self.lgr
  
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 4 for calling the LoggerHelper obj's underlying member method code with example usage: obj.get_initialized_logger(logtarget) and returns: self, self, unknown, self