Put a mutex around CLog::write

Loggers exist in different threads and shouldn't be allowed to write
at the same time.

Maybe fixes Issue #224 (but maybe not)
logger thread safety: use a lock object instead of a mutex
Merge branch 'LoggerFix' into HideUninitializedDevices