This patch introduces the concept of a log handlers. Log handlers allow customizing the way log output is emitted. The StreamCallback class tried to do something conceptually similar. The benefit of the log handler interface is that you don't need to conform to llvm's raw_ostream interface.
This patch is in preparation for a new kind of a new type of log handler.
Maybe we don't expose this mutex at all and we have a EmitThreadSafe(...) method?: