code: def init_base_logging(directory="./log", verbose=0, silent=False, color=False, no_file=False,
                        truncate=True, config_location=None):
      global LOGPATHDIR
      global STANDALONE_LOGGING
      global TRUNCATE_LOG
      global COLOR_ON
      global SILENT_ON
      global VERBOSE_LEVEL
      if config_location:
          try:
              _read_config(config_location)
          except IOError as error:
              raise IOError("Unable to read from configuration file {}: {}".format(config_location,
                                                                                   error))
          except jsonschema.SchemaError as error:
              raise jsonschema.SchemaError("Logging configuration schema "
                                           "file malformed: {}".format(error))
      LOGPATHDIR = os.path.join(directory, datetime.datetime.now().strftime(
          "%Y-%m-%d_%H%M%S.%f").rstrip("0"))
      icetealogger = logging.getLogger("icetea")
      icetealogger.propagate = False
      icetealogger.setLevel(logging.DEBUG)
      stream_handler = logging.StreamHandler()
      formatter = BenchFormatter(LOGGING_CONFIG.get("IceteaManager").get("format"),
                                 LOGGING_CONFIG.get("IceteaManager").get("dateformat"))
      if not color:
          stream_handler.setFormatter(formatter)
      elif color and not COLORS:
          raise ImportError("Missing coloredlogs module. Please install with "
                            "pip to use colors in logging.")
      else:
          class ColoredBenchFormatter(coloredlogs.ColoredFormatter):
              converter = datetime.datetime.fromtimestamp
              def formatTime(self, record, datefmt=None):
                  date_and_time = self.converter(record.created, tz=pytz.utc)
                  if "%F" in datefmt:
                      msec = "%03d" % record.msecs
                      datefmt = datefmt.replace("%F", msec)
                  str_time = date_and_time.strftime(datefmt)
                  return str_time
          COLOR_ON = color
          stream_handler.setFormatter(ColoredBenchFormatter(
              LOGGING_CONFIG.get("IceteaManager").get("format"),
              LOGGING_CONFIG.get("IceteaManager").get("dateformat"),
              LEVEL_FORMATS, FIELD_STYLES))
      SILENT_ON = silent
      VERBOSE_LEVEL = verbose
      if not no_file:
          try:
              os.makedirs(LOGPATHDIR)
          except OSError:
              raise OSError("Log path %s already exists." % LOGPATHDIR)
          filename = LOGGING_CONFIG.get("IceteaManager").get("file").get("name", "icetea.log")
          icetealogger = _add_filehandler(icetealogger, get_base_logfilename(filename),
                                          formatter, "IceteaManager")
      if verbose and not silent:
          stream_handler.setLevel(logging.DEBUG)
      elif silent:
          stream_handler.setLevel(logging.WARN)
      else:
          stream_handler.setLevel(getattr(logging, LOGGING_CONFIG.get("IceteaManager").get("level")))
      icetealogger.addHandler(stream_handler)
      TRUNCATE_LOG = truncate
      if TRUNCATE_LOG:
          icetealogger.addFilter(ContextFilter())
      STANDALONE_LOGGING = False