]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Add master_service_init_log_with_pid()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Apr 2020 18:28:40 +0000 (21:28 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 24 Apr 2020 10:42:00 +0000 (10:42 +0000)
src/lib-master/master-service.c
src/lib-master/master-service.h

index 9e072d2d1e8f1ff08e83a110a5c8040a42802f0d..fd4a61c82e1a36322d44d6a18c954c5fc371bcee 100644 (file)
@@ -5,6 +5,7 @@
 #include "lib-event-private.h"
 #include "event-filter.h"
 #include "ioloop.h"
+#include "hostpid.h"
 #include "path-util.h"
 #include "array.h"
 #include "strescape.h"
@@ -514,6 +515,12 @@ void master_service_init_log(struct master_service *service,
                service->log_initialized = TRUE;
 }
 
+void master_service_init_log_with_pid(struct master_service *service)
+{
+       master_service_init_log(service, t_strdup_printf(
+               "%s(%s): ", service->configured_name, my_pid));
+}
+
 void master_service_init_stats_client(struct master_service *service,
                                      bool silent_notfound_errors)
 {
index 92adbbf8d4f31f83839089f869396a88eb967a92..b8f9904873757ead17f4a043378d4f2406252285 100644 (file)
@@ -131,6 +131,8 @@ void master_service_env_clean(void);
    functions. The following calls change the log prefix. */
 void master_service_init_log(struct master_service *service,
                             const char *prefix);
+/* Initialize/change log prefix to "configured_name(my_pid): " */
+void master_service_init_log_with_pid(struct master_service *service);
 /* Initialize stats client (if it's not already initialized). This is called
    automatically if MASTER_SERVICE_FLAG_SEND_STATS is enabled. If
    silent_notfound_errors is set, connect() errors aren't logged if they're