Added logging functionality, first thing.
Logging now uses a static mutex. Somewhat undesirable, but it promotes logging.