REORG: include: move log.h to haproxy/log{,-t}.h

The current state of the logging is a real mess. The main problem is
that almost all files include log.h just in order to have access to
the alert/warning functions like ha_alert() etc, and don't care about
logs. But log.h also deals with real logging as well as log-format and
depends on stream.h and various other things. As such it forces a few
heavy files like stream.h to be loaded early and to hide missing
dependencies depending where it's loaded. Among the missing ones is
syslog.h which was often automatically included resulting in no less
than 3 users missing it.

Among 76 users, only 5 could be removed, and probably 70 don't need the
full set of dependencies.

A good approach would consist in splitting that file in 3 parts:
  - one for error output ("errors" ?).
  - one for log_format processing
  - and one for actual logging.
diff --git a/src/51d.c b/src/51d.c
index 37124ea..12f40ea 100644
--- a/src/51d.c
+++ b/src/51d.c
@@ -8,10 +8,10 @@
 #include <haproxy/http_ana.h>
 #include <haproxy/http_fetch.h>
 #include <haproxy/http_htx.h>
+#include <haproxy/log.h>
 #include <haproxy/thread.h>
 #include <haproxy/global.h>
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <haproxy/sample.h>
 #include <import/xxhash.h>
 #include <import/lru.h>
diff --git a/src/acl.c b/src/acl.c
index 275087d..f3332ac 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -18,13 +18,13 @@
 #include <haproxy/auth.h>
 #include <haproxy/api.h>
 #include <haproxy/list.h>
+#include <haproxy/log.h>
 #include <haproxy/pattern.h>
 #include <haproxy/tools.h>
 
 #include <haproxy/global.h>
 
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <haproxy/sample.h>
 #include <haproxy/stick_table.h>
diff --git a/src/action.c b/src/action.c
index fa3b4f7..9997903 100644
--- a/src/action.c
+++ b/src/action.c
@@ -15,10 +15,10 @@
 #include <haproxy/obj_type.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
+#include <haproxy/log.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <haproxy/stick_table.h>
 
diff --git a/src/auth.c b/src/auth.c
index faac16d..646c010 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -29,11 +29,10 @@
 #include <haproxy/api.h>
 #include <haproxy/global.h>
 #include <haproxy/errors.h>
+#include <haproxy/log.h>
 #include <haproxy/pattern-t.h>
 #include <haproxy/thread.h>
 
-#include <proto/log.h>
-
 struct userlist *userlist = NULL;    /* list of all existing userlists */
 
 #ifdef USE_LIBCRYPT
diff --git a/src/backend.c b/src/backend.c
index f79ac18..423163f 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -34,6 +34,7 @@
 #include <haproxy/lb_fwlc.h>
 #include <haproxy/lb_fwrr.h>
 #include <haproxy/lb_map.h>
+#include <haproxy/log.h>
 #include <haproxy/obj_type.h>
 #include <haproxy/payload.h>
 #include <haproxy/session.h>
@@ -48,7 +49,6 @@
 
 #include <haproxy/arg.h>
 #include <proto/backend.h>
-#include <proto/log.h>
 #include <haproxy/protocol.h>
 #include <haproxy/proto_tcp.h>
 #include <proto/proxy.h>
diff --git a/src/cache.c b/src/cache.c
index 17d015a..0858a8d 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -18,6 +18,7 @@
 #include <haproxy/http_ana.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/http_rules.h>
+#include <haproxy/log.h>
 #include <haproxy/shctx.h>
 #include <haproxy/stream_interface.h>
 #include <import/eb32tree.h>
@@ -26,7 +27,6 @@
 #include <types/proxy.h>
 
 #include <proto/proxy.h>
-#include <proto/log.h>
 #include <proto/stream.h>
 
 
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 8bd60b7..a15028b 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -55,6 +55,7 @@
 #include <haproxy/lb_fwrr.h>
 #include <haproxy/lb_map.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/mailers-t.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/peers-t.h>
@@ -71,7 +72,6 @@
 #include <haproxy/global.h>
 
 #include <proto/backend.h>
-#include <proto/log.h>
 #include <haproxy/protocol.h>
 #include <proto/proxy.h>
 #include <haproxy/peers.h>
diff --git a/src/check.c b/src/check.c
index 7381a32..6b4f9fa 100644
--- a/src/check.c
+++ b/src/check.c
@@ -46,6 +46,7 @@
 #include <haproxy/http_htx.h>
 #include <haproxy/h1.h>
 #include <haproxy/htx.h>
+#include <haproxy/log.h>
 #include <haproxy/signal.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stats-t.h>
@@ -58,14 +59,12 @@
 #include <haproxy/arg.h>
 #include <proto/backend.h>
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <proto/queue.h>
 #include <haproxy/port_range.h>
 #include <haproxy/proto_tcp.h>
 #include <haproxy/protocol.h>
 #include <proto/proxy.h>
 #include <proto/server.h>
-#include <proto/log.h>
 #include <haproxy/proto_udp.h>
 #include <haproxy/sample.h>
 
diff --git a/src/cli.c b/src/cli.c
index 9e6b56a..e5413e9 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -36,6 +36,7 @@
 #include <haproxy/frontend.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/mworker-t.h>
 #include <haproxy/pattern-t.h>
 #include <haproxy/peers.h>
@@ -57,7 +58,6 @@
 #include <haproxy/compression.h>
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/log.h>
 #include <haproxy/pipe.h>
 #include <haproxy/protocol.h>
 #include <proto/proxy.h>
diff --git a/src/da.c b/src/da.c
index 1d62ade..6090851 100644
--- a/src/da.c
+++ b/src/da.c
@@ -8,9 +8,9 @@
 #include <haproxy/http_fetch.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/htx.h>
+#include <haproxy/log.h>
 #include <haproxy/global.h>
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <haproxy/sample.h>
 #include <dac.h>
 
diff --git a/src/debug.c b/src/debug.c
index 4f7e6ce..6829eb2 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -16,6 +16,7 @@
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <syslog.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
@@ -24,6 +25,7 @@
 #include <haproxy/cli.h>
 #include <haproxy/debug.h>
 #include <haproxy/hlua.h>
+#include <haproxy/log.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
 #include <haproxy/thread.h>
diff --git a/src/dns.c b/src/dns.c
index 7658f6f..bcbc435 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -28,6 +28,7 @@
 #include <haproxy/dns.h>
 #include <haproxy/errors.h>
 #include <haproxy/http_rules.h>
+#include <haproxy/log.h>
 #include <haproxy/sample.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/stream_interface.h>
@@ -41,7 +42,6 @@
 #include <haproxy/global.h>
 
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <proto/server.h>
 #include <haproxy/proto_udp.h>
 #include <proto/proxy.h>
diff --git a/src/ev_evports.c b/src/ev_evports.c
index 3d60247..81cbe51 100644
--- a/src/ev_evports.c
+++ b/src/ev_evports.c
@@ -28,7 +28,6 @@
 
 #include <haproxy/activity.h>
 #include <haproxy/fd.h>
-#include <proto/log.h>
 
 /*
  * Private data:
diff --git a/src/fcgi-app.c b/src/fcgi-app.c
index 629c677..d7183c5 100644
--- a/src/fcgi-app.c
+++ b/src/fcgi-app.c
@@ -19,6 +19,7 @@
 #include <haproxy/filters.h>
 #include <haproxy/http_fetch.h>
 #include <haproxy/http_htx.h>
+#include <haproxy/log.h>
 #include <haproxy/regex.h>
 #include <haproxy/sample.h>
 #include <haproxy/session.h>
@@ -26,7 +27,6 @@
 
 #include <haproxy/global.h>
 
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/server.h>
 
diff --git a/src/fd.c b/src/fd.c
index 82f6196..d3940bb 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -92,7 +92,6 @@
 #include <haproxy/global.h>
 
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <haproxy/port_range.h>
 
 struct fdtab *fdtab = NULL;     /* array of all the file descriptors */
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index f532d2d..f5094c0 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -19,6 +19,7 @@
 #include <haproxy/filters.h>
 #include <haproxy/frontend.h>
 #include <haproxy/http_rules.h>
+#include <haproxy/log.h>
 #include <haproxy/sample.h>
 #include <haproxy/signal.h>
 #include <haproxy/thread.h>
@@ -37,7 +38,6 @@
 #include <haproxy/arg.h>
 #include <proto/backend.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/spoe.h>
 #include <proto/stream.h>
diff --git a/src/flt_trace.c b/src/flt_trace.c
index 2f55b73..01278bb 100644
--- a/src/flt_trace.c
+++ b/src/flt_trace.c
@@ -18,6 +18,7 @@
 #include <haproxy/http_ana-t.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/htx.h>
+#include <haproxy/log.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 
@@ -25,7 +26,6 @@
 #include <types/proxy.h>
 #include <types/stream.h>
 
-#include <proto/log.h>
 #include <proto/stream.h>
 
 const char *trace_flt_id = "trace filter";
diff --git a/src/frontend.c b/src/frontend.c
index 09adbea..8252c81 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -27,6 +27,7 @@
 #include <haproxy/chunk.h>
 #include <haproxy/frontend.h>
 #include <haproxy/http_ana.h>
+#include <haproxy/log.h>
 #include <haproxy/sample.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
@@ -37,7 +38,6 @@
 
 #include <haproxy/arg.h>
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <haproxy/proto_tcp.h>
 #include <proto/proxy.h>
 #include <proto/stream.h>
diff --git a/src/haproxy.c b/src/haproxy.c
index 6488df9..9e2f94a 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -97,6 +97,7 @@
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/mworker.h>
 #include <haproxy/namespace.h>
 #include <haproxy/net_helper.h>
@@ -123,7 +124,6 @@
 #include <haproxy/arg.h>
 #include <proto/backend.h>
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <haproxy/protocol.h>
 #include <proto/proxy.h>
 #include <proto/queue.h>
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index c14c885..12bca02 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -21,6 +21,7 @@
 #include <haproxy/cli-t.h>
 #include <haproxy/hlua-t.h>
 #include <haproxy/http.h>
+#include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/regex.h>
 #include <haproxy/stats.h>
diff --git a/src/http_act.c b/src/http_act.c
index 06ab3c2..a688acb 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -38,7 +38,6 @@
 #include <haproxy/capture-t.h>
 
 #include <haproxy/arg.h>
-#include <proto/log.h>
 
 /* Release memory allocated by most of HTTP actions. Concretly, it releases
  * <arg.http>.
diff --git a/src/http_ana.c b/src/http_ana.c
index 8e8dd2f..373e399 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -22,6 +22,7 @@
 #include <haproxy/http_ana.h>
 #include <haproxy/http_htx.h>
 #include <haproxy/htx.h>
+#include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/regex.h>
 #include <haproxy/stats.h>
@@ -31,7 +32,6 @@
 
 #include <haproxy/capture-t.h>
 
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/server.h>
 #include <proto/stream.h>
diff --git a/src/http_fetch.c b/src/http_fetch.c
index 65fbe87..812ede5 100644
--- a/src/http_fetch.c
+++ b/src/http_fetch.c
@@ -37,7 +37,6 @@
 #include <haproxy/version.h>
 
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <proto/stream.h>
 
 
diff --git a/src/listener.c b/src/listener.c
index ab0a4a7..1779642 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -26,6 +26,7 @@
 #include <haproxy/global.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
@@ -34,7 +35,6 @@
 
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/log.h>
 #include <haproxy/protocol.h>
 #include <haproxy/proto_sockpair.h>
 #include <haproxy/sample.h>
diff --git a/src/log.c b/src/log.c
index 4f095ca..4027db2 100644
--- a/src/log.c
+++ b/src/log.c
@@ -29,6 +29,7 @@
 #include <haproxy/cli.h>
 #include <haproxy/frontend.h>
 #include <haproxy/http.h>
+#include <haproxy/log.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tools.h>
@@ -36,10 +37,8 @@
 #include <haproxy/version.h>
 
 #include <haproxy/global.h>
-#include <types/log.h>
 
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <haproxy/ring.h>
 #include <haproxy/sample.h>
 #include <haproxy/sink.h>
diff --git a/src/map.c b/src/map.c
index 7beefde..243676d 100644
--- a/src/map.c
+++ b/src/map.c
@@ -23,7 +23,6 @@
 #include <haproxy/tools.h>
 
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <haproxy/sample.h>
 
 /* Parse an IPv4 or IPv6 address and store it into the sample.
diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c
index 2bb5862..e13ce55 100644
--- a/src/mux_fcgi.c
+++ b/src/mux_fcgi.c
@@ -21,6 +21,7 @@
 #include <haproxy/htx.h>
 #include <import/ist.h>
 #include <haproxy/list.h>
+#include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/regex.h>
 #include <haproxy/session-t.h>
@@ -29,7 +30,6 @@
 
 #include <types/proxy.h>
 
-#include <proto/log.h>
 #include <proto/stream.h>
 #include <haproxy/trace.h>
 
diff --git a/src/mux_h1.c b/src/mux_h1.c
index ada8bb1..75a6408 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -24,7 +24,7 @@
 #include <types/proxy.h>
 
 #include <haproxy/http_htx.h>
-#include <proto/log.h>
+#include <haproxy/log.h>
 #include <haproxy/session-t.h>
 #include <proto/stream.h>
 #include <haproxy/stream_interface.h>
diff --git a/src/mworker-prog.c b/src/mworker-prog.c
index 0a448be..800624f 100644
--- a/src/mworker-prog.c
+++ b/src/mworker-prog.c
@@ -23,9 +23,9 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
+#include <haproxy/log.h>
 #include <haproxy/mworker.h>
 
-#include <proto/log.h>
 
 static int use_program = 0; /* do we use the program section ? */
 
diff --git a/src/mworker.c b/src/mworker.c
index bccffaa..d891f2f 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -22,6 +22,7 @@
 #include <haproxy/cli.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/mworker.h>
 #include <haproxy/peers.h>
 #include <haproxy/signal.h>
@@ -31,7 +32,6 @@
 #include <haproxy/global.h>
 
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/stream.h>
 
diff --git a/src/namespace.c b/src/namespace.c
index dfda7a5..8b7190c 100644
--- a/src/namespace.c
+++ b/src/namespace.c
@@ -14,8 +14,8 @@
 #include <haproxy/namespace.h>
 #include <haproxy/hash.h>
 #include <haproxy/errors.h>
+#include <haproxy/log.h>
 #include <haproxy/signal.h>
-#include <proto/log.h>
 
 /* Opens the namespace <ns_name> and returns the FD or -1 in case of error
  * (check errno).
diff --git a/src/pattern.c b/src/pattern.c
index 0ec22c1..bbd7faa 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -16,12 +16,12 @@
 
 #include <haproxy/api.h>
 #include <haproxy/global.h>
+#include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/pattern.h>
 #include <haproxy/regex.h>
 #include <haproxy/tools.h>
 
-#include <proto/log.h>
 #include <haproxy/sample.h>
 
 #include <import/ebsttree.h>
diff --git a/src/peers.c b/src/peers.c
index c5d8095..633f9ae 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -26,6 +26,7 @@
 #include <haproxy/cli.h>
 #include <haproxy/dict.h>
 #include <haproxy/frontend.h>
+#include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/peers.h>
@@ -39,7 +40,6 @@
 #include <haproxy/thread.h>
 
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/stream.h>
 #include <haproxy/stick_table.h>
diff --git a/src/pool.c b/src/pool.c
index 41d9c44..78809bb 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -21,13 +21,13 @@
 #include <haproxy/thread.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
+#include <haproxy/log.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tools.h>
 
 #include <haproxy/activity-t.h>
 
-#include <proto/log.h>
 
 #ifdef CONFIG_HAP_LOCAL_POOLS
 /* These are the most common pools, expected to be initialized first. These
diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c
index cb18536..c72c6ac 100644
--- a/src/proto_sockpair.c
+++ b/src/proto_sockpair.c
@@ -32,13 +32,13 @@
 #include <haproxy/global.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 #include <haproxy/version.h>
 
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/log.h>
 #include <haproxy/protocol.h>
 
 static void sockpair_add_listener(struct listener *listener, int port);
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index b25779c..63624f6 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -39,6 +39,7 @@
 #include <haproxy/http_rules.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/sample.h>
 #include <haproxy/tools.h>
 #include <haproxy/namespace.h>
@@ -47,7 +48,6 @@
 
 #include <haproxy/arg.h>
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <haproxy/port_range.h>
 #include <haproxy/protocol.h>
 #include <haproxy/proto_tcp.h>
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 33c79e9..ea516ba 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -32,12 +32,12 @@
 #include <haproxy/global.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 #include <haproxy/version.h>
 
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <haproxy/protocol.h>
 
 static int uxst_bind_listener(struct listener *listener, char *errmsg, int errlen);
diff --git a/src/proxy.c b/src/proxy.c
index 78d91e6..6a0a158 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -26,6 +26,7 @@
 #include <haproxy/global.h>
 #include <haproxy/http_ana.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/peers.h>
 #include <haproxy/pool.h>
@@ -41,7 +42,6 @@
 
 #include <proto/backend.h>
 #include <haproxy/fd.h>
-#include <proto/log.h>
 #include <haproxy/proto_tcp.h>
 #include <proto/proxy.h>
 #include <proto/server.h>
diff --git a/src/raw_sock.c b/src/raw_sock.c
index 3453aac..099f503 100644
--- a/src/raw_sock.c
+++ b/src/raw_sock.c
@@ -26,6 +26,7 @@
 #include <haproxy/buf.h>
 #include <haproxy/connection.h>
 #include <haproxy/global.h>
+#include <haproxy/log.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
@@ -33,7 +34,6 @@
 
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/log.h>
 #include <haproxy/pipe.h>
 
 
diff --git a/src/regex.c b/src/regex.c
index b2f325d..3510f72 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -15,9 +15,9 @@
 #include <string.h>
 
 #include <haproxy/api.h>
+#include <haproxy/log.h>
 #include <haproxy/regex.h>
 #include <haproxy/tools.h>
-#include <proto/log.h>
 
 /* regex trash buffer used by various regex tests */
 THREAD_LOCAL regmatch_t pmatch[MAX_MATCH];  /* rm_so, rm_eo for regular expressions */
diff --git a/src/sample.c b/src/sample.c
index 23f7bf2..99b6fd5 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -24,6 +24,7 @@
 #include <haproxy/global.h>
 #include <haproxy/hash.h>
 #include <haproxy/http.h>
+#include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/protobuf.h>
 #include <haproxy/regex.h>
@@ -34,7 +35,6 @@
 #include <haproxy/base64.h>
 
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <haproxy/sink.h>
 #include <haproxy/stick_table.h>
diff --git a/src/session.c b/src/session.c
index 58e55ee..4169870 100644
--- a/src/session.c
+++ b/src/session.c
@@ -15,12 +15,12 @@
 #include <haproxy/global.h>
 #include <haproxy/http.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/pool.h>
 #include <haproxy/session.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/vars.h>
 
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/stream.h>
 
diff --git a/src/signal.c b/src/signal.c
index 6d01548..1f8ec83 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -13,9 +13,9 @@
 #include <signal.h>
 #include <string.h>
 
+#include <haproxy/log.h>
 #include <haproxy/task.h>
 #include <haproxy/signal.h>
-#include <proto/log.h>
 
 /* Principle : we keep an in-order list of the first occurrence of all received
  * signals. All occurrences of a same signal are grouped though. The signal
diff --git a/src/sink.c b/src/sink.c
index 93beccf..b6e1b85 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -23,8 +23,8 @@
 #include <haproxy/cli.h>
 #include <import/ist.h>
 #include <haproxy/list.h>
+#include <haproxy/log.h>
 #include <haproxy/time.h>
-#include <proto/log.h>
 #include <haproxy/ring.h>
 #include <haproxy/signal.h>
 #include <haproxy/sink.h>
diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c
index 43fe01d..d2fd4e1 100644
--- a/src/ssl_ckch.c
+++ b/src/ssl_ckch.c
@@ -16,6 +16,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <unistd.h>
 
 #include <sys/stat.h>
diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c
index 3890ca8..8e6a2e4 100644
--- a/src/ssl_crtlist.c
+++ b/src/ssl_crtlist.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index a586b62..1b1b0e4 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -53,6 +53,7 @@
 #include <haproxy/frontend.h>
 #include <haproxy/global.h>
 #include <haproxy/http_rules.h>
+#include <haproxy/log.h>
 #include <haproxy/openssl-compat.h>
 #include <haproxy/pattern-t.h>
 #include <haproxy/shctx.h>
@@ -77,7 +78,6 @@
 #include <haproxy/freq_ctr.h>
 #include <haproxy/proto_tcp.h>
 #include <proto/server.h>
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <proto/stream.h>
 
diff --git a/src/stats.c b/src/stats.c
index 5737215..40ea9c8 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -41,6 +41,7 @@
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
 #include <haproxy/listener.h>
+#include <haproxy/log.h>
 #include <haproxy/map-t.h>
 #include <haproxy/pattern-t.h>
 #include <haproxy/session.h>
@@ -58,7 +59,6 @@
 #include <proto/backend.h>
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/log.h>
 #include <haproxy/pipe.h>
 #include <proto/proxy.h>
 #include <proto/stream.h>
diff --git a/src/stick_table.c b/src/stick_table.c
index 3a8d62f..fdf1b58 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -21,6 +21,7 @@
 #include <haproxy/http_rules.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
+#include <haproxy/log.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/peers.h>
 #include <haproxy/stats-t.h>
@@ -34,7 +35,6 @@
 #include <import/ebsttree.h>
 
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <haproxy/proto_tcp.h>
 #include <proto/proxy.h>
 #include <haproxy/sample.h>
diff --git a/src/stream.c b/src/stream.c
index fc2798d..eab3356 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -36,6 +36,7 @@
 #include <haproxy/istbuf.h>
 #include <haproxy/thread.h>
 #include <haproxy/htx.h>
+#include <haproxy/log.h>
 #include <haproxy/pool.h>
 #include <haproxy/session.h>
 #include <haproxy/stats-t.h>
@@ -49,7 +50,6 @@
 #include <proto/backend.h>
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
-#include <proto/log.h>
 #include <proto/stream.h>
 #include <haproxy/pipe.h>
 #include <proto/proxy.h>
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index e7abdd7..a02e25f 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -18,6 +18,7 @@
 #include <haproxy/connection.h>
 #include <haproxy/global.h>
 #include <haproxy/list.h>
+#include <haproxy/log.h>
 #include <haproxy/sample.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/tcp_rules.h>
@@ -27,7 +28,6 @@
 
 #include <haproxy/arg-t.h>
 
-#include <proto/log.h>
 #include <proto/proxy.h>
 #include <haproxy/stick_table.h>
 #include <proto/stream.h>
diff --git a/src/trace.c b/src/trace.c
index bb9db08..997a994 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -24,7 +24,7 @@
 #include <haproxy/cli.h>
 #include <haproxy/istbuf.h>
 #include <haproxy/list.h>
-#include <proto/log.h>
+#include <haproxy/log.h>
 #include <haproxy/sink.h>
 #include <haproxy/trace.h>
 
diff --git a/src/uri_auth.c b/src/uri_auth.c
index 2005bc8..248431c 100644
--- a/src/uri_auth.c
+++ b/src/uri_auth.c
@@ -15,10 +15,10 @@
 
 #include <haproxy/api.h>
 #include <haproxy/base64.h>
+#include <haproxy/log.h>
 #include <haproxy/stats-t.h>
 #include <haproxy/uri_auth.h>
 
-#include <proto/log.h>
 
 /*
  * Initializes a basic uri_auth structure header and returns a pointer to it.
diff --git a/src/wdt.c b/src/wdt.c
index 3485c8f..c17d67c3 100644
--- a/src/wdt.c
+++ b/src/wdt.c
@@ -15,9 +15,9 @@
 #include <haproxy/api.h>
 #include <haproxy/debug.h>
 #include <haproxy/global.h>
+#include <haproxy/log.h>
 #include <haproxy/thread.h>
 #include <haproxy/tools.h>
-#include <proto/log.h>
 
 
 /*
diff --git a/src/wurfl.c b/src/wurfl.c
index f7992e5..57e794e 100644
--- a/src/wurfl.c
+++ b/src/wurfl.c
@@ -10,8 +10,8 @@
 #include <haproxy/http_ana.h>
 #include <haproxy/http_fetch.h>
 #include <haproxy/http_htx.h>
+#include <haproxy/log.h>
 #include <haproxy/arg.h>
-#include <proto/log.h>
 #include <haproxy/sample.h>
 #include <import/ebsttree.h>
 #include <import/ebmbtree.h>