code: def emit(self, record):
      
      # People occasionally call logging functions at import time before
      # our flags may have even been defined yet, let alone even parsed, as we
      # rely on the C++ side to define some flags for us and app init to
      # deal with parsing.  Match the C++ library behavior of notify and emit
      # such messages to stderr.  It encourages people to clean-up and does
      # not hide the message.
      level = record.levelno
      if not FLAGS.is_parsed():  # Also implies "before flag has been defined".
        global _warn_preinit_stderr
        if _warn_preinit_stderr:
          sys.stderr.write(
              'WARNING: Logging before flag parsing goes to stderr.\n')
          _warn_preinit_stderr = False
        self._log_to_stderr(record)
      elif FLAGS['logtostderr'].value:
        self._log_to_stderr(record)
      else:
        super(PythonHandler, self).emit(record)
        stderr_threshold = converter.string_to_standard(
            FLAGS['stderrthreshold'].value)
        if ((FLAGS['alsologtostderr'].value or level >= stderr_threshold) and
            self.stream != sys.stderr):
          self._log_to_stderr(record)
      # Die when the record is created from ABSLLogger and level is FATAL.
      if _is_absl_fatal_record(record):
        self.flush()  # Flush the log before dying.
  
        # In threaded python, sys.exit() from a non-main thread only
        # exits the thread in question.
        os.abort()
docs: Prints a record out to some streams.
  
      If FLAGS.logtostderr is set, it will print to sys.stderr ONLY.
      If FLAGS.alsologtostderr is set, it will print to sys.stderr.
      If FLAGS.logtostderr is not set, it will log to the stream
        associated with the current thread.
  
      Args:
        record: logging.LogRecord, the record to emit.