#include "lib.h"
#include "lib-signals.h"
+#include "lib-event-private.h"
#include "event-filter.h"
#include "ioloop.h"
#include "path-util.h"
struct master_service *master_service;
+static struct event_category master_service_category = {
+ .name = NULL, /* set dynamically later */
+};
+static char *master_service_category_name;
+
static void master_service_io_listeners_close(struct master_service *service);
static void master_service_refresh_login_state(struct master_service *service);
static void
master_service_refresh_login_state(service);
}
+static bool
+master_service_event_callback(struct event *event,
+ enum event_callback_type type,
+ struct failure_context *ctx ATTR_UNUSED,
+ const char *fmt ATTR_UNUSED,
+ va_list args ATTR_UNUSED)
+{
+ if (type == EVENT_CALLBACK_TYPE_CREATE && event->parent == NULL) {
+ /* Add service:<name> category for all events. It's enough
+ to do it only for root events, because all other events
+ inherit the category from them. */
+ event_add_category(event, &master_service_category);
+ }
+ return TRUE;
+}
+
static void master_service_verify_version_string(struct master_service *service)
{
if (service->version_string != NULL &&
else
i_set_failure_prefix("%s: ", name);
+ master_service_category_name =
+ i_strdup_printf("service:%s", service->name);
+ master_service_category.name = master_service_category_name;
+ event_register_callback(master_service_event_callback);
+
/* Initialize debug logging */
value = getenv(DOVECOT_LOG_DEBUG_ENV);
if (value != NULL) {
settings_parser_deinit(&service->set_parser);
pool_unref(&service->set_pool);
}
+ i_free(master_service_category_name);
+ master_service_category.name = NULL;
+ event_unregister_callback(master_service_event_callback);
lib_signals_deinit();
/* run atexit callbacks before destroying ioloop */
lib_atexit_run();