title: Implementation of Custom Logging Handler
body: <p>I was trying to implement custom handler. The purpose of the custom handler is adding extra fields to the log message and make multiline error messages one line. This is what I came up so far:</p>
  
  <pre><code>class CustomStreamHandler(logging.StreamHandler):
      def __init__(self):
          logging.StreamHandler.__init__(self)
          self.formatter = '%(asctime)s %(levelname)s %(name)s %(message)s'\
              '\tcustomfiel_id=%(customfiel_id)s'\
              '\tcustomfiel_name=%(customfiel_name)s'
  
      def format(self, record):
          if record.exc_info:
              record.msg += repr(super().formatException(record.exc_info))
              record.exc_info = None
          result = super().format(record)
          return result
  
      def emit(self, record):
          pass
  </code></pre>
  
  <p>The <code>format</code> method will convert multi-line logs to one-line. But I am stuck. How can I add custom fields to all logs that use this handler. By the way currently it is not functioning as it is supposed to be. How should I continue?</p>