original_docstring: Creates a logger with tqdm- and file-handler.
docstring: Creates a logger with tqdm- and file-handler.
docstring_tokens: Creates a logger with tqdm - and file - handler .
code: def _create_logger(name, out_dir, level=logging.INFO):
          """Creates a logger with tqdm- and file-handler."""
          # init logging
          logger = logging.getLogger(name)
          logger.setLevel(level)
  
          if not hasattr(logger, "log_orig"):
  
              def _colored_log(level, msg, *args, color=None, **kwargs):
                  extra = kwargs.get("extra", {})
                  extra["color"] = color
  
                  kwargs["extra"] = extra
                  logger.log_orig(level, msg, *args, **kwargs)
  
              logger.log_orig = logger._log
              logger._log = _colored_log
  
          if not len(logger.handlers) > 0:
              ch = TqdmHandler()
              fh = logging.FileHandler(filename=os.path.join(out_dir, "log.txt"))
  
              fh.setFormatter(ColorLineFormatter(False))
              ch.setFormatter(ColorLineFormatter(True))
  
              logger.addHandler(ch)
              logger.addHandler(fh)
  
          return logger
code_tokens: def _create_logger ( name , out_dir , level = logging . INFO ) : logger = logging . getLogger ( name ) logger . setLevel ( level ) if not hasattr ( logger , "log_orig" ) : def _colored_log ( level , msg , * args , color = None , ** kwargs ) : extra = kwargs . get ( "extra" , { } ) extra [ "color" ] = color kwargs [ "extra" ] = extra logger . log_orig ( level , msg , * args , ** kwargs ) logger . log_orig = logger . _log logger . _log = _colored_log if not len ( logger . handlers ) > 0 : ch = TqdmHandler ( ) fh = logging . FileHandler ( filename = os . path . join ( out_dir , "log.txt" ) ) fh . setFormatter ( ColorLineFormatter ( False ) ) ch . setFormatter ( ColorLineFormatter ( True ) ) logger . addHandler ( ch ) logger . addHandler ( fh ) return logger
short_docstring: Creates a logger with tqdm- and file-handler.
short_docstring_tokens: Creates a logger with tqdm - and file - handler .
comment: """Creates a logger with tqdm- and file-handler."""$SEP$# init logging