MEDIUM: threads/logs: Make logs thread-safe

log buffers and static variables used in log functions are now thread-local. So
there is no need to lock anything to log messages. Moreover, per-thread
init/deinit functions are now used to initialize these buffers.
diff --git a/include/proto/log.h b/include/proto/log.h
index 72ff744..ec00809 100644
--- a/include/proto/log.h
+++ b/include/proto/log.h
@@ -28,6 +28,8 @@
 
 #include <common/config.h>
 #include <common/memory.h>
+#include <common/hathreads.h>
+
 #include <types/log.h>
 #include <types/proxy.h>
 #include <types/stream.h>
@@ -42,10 +44,10 @@
 
 extern char default_rfc5424_sd_log_format[];
 
-extern char *logheader;
-extern char *logheader_rfc5424;
-extern char *logline;
-extern char *logline_rfc5424;
+extern THREAD_LOCAL char *logheader;
+extern THREAD_LOCAL char *logheader_rfc5424;
+extern THREAD_LOCAL char *logline;
+extern THREAD_LOCAL char *logline_rfc5424;
 
 
 /*