title: logging: print message only once
body: <p>I'm using the <code>logging</code> module in python 3, and want a particular warning message to be displayed only once.
  The problem is that the check is inside a loop:</p>
  
  <pre><code>def canned_example():
      logger.warning("This function hasn't been created yet")
  
  
  for i in range(10):
      canned_example()
  </code></pre>
  
  <p>Is there a flag to set inside the logging module that will denote that this particular warning is only to be displayed once? The alternative is to keep a record of different flags, but I'd like to keep it simple if possible.</p>
  
  <p><strong>Update:</strong> Amir Yazdanbakhsh has posted an answer in the comments that allows us to do this for all messages. Ideally, I'd like some per-message flag:</p>
  
  <pre><code>def canned_example():
      logger.warning("This function hasn't been created yet", norepeat=True)
  
  
  for i in range(10):
      canned_example()
  </code></pre>