Cache the name of a maildir.

  Since they are never renamed we can do this safely.
  Speedup: Don't write all debug strings immediately.

  Buffer them and write them in batches, unless forced.
  Force log_message() to immediately flush pending
 debug messages.