Logging with streams and thread-safety