Allow logging level to be configured at run time.

These commits allow the user to specify the logging level on the command line. I've included the ancestry of the technique, but feel free to collapse the commits into one if you prefer.