Lock log output on Log class construction and flush after each write.