Refactored log threading into a new LogWriter

* New class: LogWriter.  Background thread generation happens here, for
each write operation.