title: How to change the format of logged messages temporarily, in Python?
body: <p>What is the simplest method for temporarily changing the logging message format, in Python (through the logging module)?</p>
  
  <p>The goal is to have some standard message format, while being able to temporarily add information about some file being read (like its name); the message format should revert to its default when the file is not being read anymore.  The program that produces the messages is <em>not</em> aware of what file is being read, so it would be nice if its message automatically included the relevant file name (the error message would be: "ERROR <em>while reading file</em> ***: …" instead of "ERROR: …").</p>