old_contents: import botconfig
  import datetime
  import time
  
  # replace characters that can't be encoded with '?'
  # since windows likes to use weird encodings by default
  utf8stdout = open(1, 'w', errors="replace", closefd=False) # stdout
  
  def get_timestamp(use_utc=None, ts_format=None):
      """Return a timestamp with timezone + offset from UTC."""
      if use_utc is None:
          use_utc = botconfig.USE_UTC
      if ts_format is None:
          ts_format = botconfig.TIMESTAMP_FORMAT
      if use_utc:
          tmf = datetime.datetime.utcnow().strftime(ts_format)
          tz = "UTC"
          offset = "+0000"
      else:
          tmf = time.strftime(ts_format)
          tz = time.tzname[0]
          offset = "+"
          if datetime.datetime.utcnow().hour > datetime.datetime.now().hour:
              offset = "-"
          offset += str(time.timezone // 36).zfill(4)
      return tmf.format(tzname=tz, tzoffset=offset).strip().upper() + " "
  
  def logger(file, write=True, display=True):
      if file is not None:
          open(file, "a").close() # create the file if it doesn't exist
      def log(*output, write=write, display=display):
          output = " ".join([str(x) for x in output]).replace("\u0002", "").replace("\x02", "") # remove bold
          if botconfig.DEBUG_MODE:
              write = True
          if botconfig.DEBUG_MODE or botconfig.VERBOSE_MODE:
              display = True
          timestamp = get_timestamp()
          if display:
              print(timestamp + output, file=utf8stdout)
          if write and file is not None:
              with open(file, "a") as f:
                  f.seek(0, 2)
                  f.write(timestamp + output + "\n")
  
      return log
  
  stream_handler = logger(None)
  
  def stream(output, level="normal"):
      if botconfig.VERBOSE_MODE or botconfig.DEBUG_MODE:
          stream_handler(output)
      elif level == "warning":
          stream_handler(output)
  
new_contents: import botconfig
  import datetime
  import time
  
  # replace characters that can't be encoded with '?'
  # since windows likes to use weird encodings by default
  utf8stdout = open(1, 'w', errors="replace", closefd=False) # stdout
  
  def get_timestamp(use_utc=None, ts_format=None):
      """Return a timestamp with timezone + offset from UTC."""
      if use_utc is None:
          use_utc = botconfig.USE_UTC
      if ts_format is None:
          ts_format = botconfig.TIMESTAMP_FORMAT
      if use_utc:
          tmf = datetime.datetime.utcnow().strftime(ts_format)
          tz = "UTC"
          offset = "+0000"
      else:
          tmf = time.strftime(ts_format)
          tz = time.tzname[0]
          offset = "+"
          if datetime.datetime.utcnow().hour > datetime.datetime.now().hour:
              offset = "-"
          offset += str(time.timezone // 36).zfill(4)
      return tmf.format(tzname=tz, tzoffset=offset).strip().upper() + " "
  
  def logger(file, write=True, display=True):
      if file is not None:
          open(file, "a").close() # create the file if it doesn't exist
      def log(*output, write=write, display=display):
          output = " ".join([str(x) for x in output]).replace("\u0002", "").replace("\x02", "") # remove bold
          if botconfig.DEBUG_MODE:
              write = True
          if botconfig.DEBUG_MODE or botconfig.VERBOSE_MODE:
              display = True
          timestamp = get_timestamp()
          if display:
              print(timestamp + output, file=utf8stdout)
          if write and file is not None:
              with open(file, "a", errors="replace") as f:
                  f.seek(0, 2)
                  f.write(timestamp + output + "\n")
  
      return log
  
  stream_handler = logger(None)
  
  def stream(output, level="normal"):
      if botconfig.VERBOSE_MODE or botconfig.DEBUG_MODE:
          stream_handler(output)
      elif level == "warning":
          stream_handler(output)
  
subject: Replace non-printable characters in files too.