title: How do I add custom field to Python log format string?
body: <p>My current format string is:</p>
  <pre><code>formatter = logging.Formatter('%(asctime)s : %(message)s')
  </code></pre>
  <p>and I want to add a new field called <code>app_name</code> which will have a different value in each script that contains this formatter.</p>
  <pre><code>import logging
  formatter = logging.Formatter('%(asctime)s %(app_name)s : %(message)s')
  syslog.setFormatter(formatter)
  logger.addHandler(syslog)
  </code></pre>
  <p>But I'm not sure how to pass that <code>app_name</code> value to the logger to interpolate into the format string. I can obviously get it to appear in the log message by passing it each time but this is messy.</p>
  <p>I've tried:</p>
  <pre><code>logging.info('Log message', app_name='myapp')
  logging.info('Log message', {'app_name', 'myapp'})
  logging.info('Log message', 'myapp')
  </code></pre>
  <p>but none work.</p>