From eda0e5e2f0509a3eea823f64c4acea8ac970b9a4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 4 Dec 2020 15:55:28 +0000 Subject: Improve the logging of service adding/deleting. --- src/modules.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') diff --git a/src/modules.cpp b/src/modules.cpp index b6a29fcfa..a39fcb6c1 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -167,6 +167,26 @@ void ServiceProvider::DisableAutoRegister() stdalgo::erase(*ServerInstance->Modules->NewServices, this); } +const char* ServiceProvider::GetTypeString() const +{ + switch (service) + { + case SERVICE_COMMAND: + return "command"; + case SERVICE_MODE: + return "mode"; + case SERVICE_METADATA: + return "metadata"; + case SERVICE_IOHOOK: + return "iohook"; + case SERVICE_DATA: + return "data service"; + case SERVICE_CUSTOM: + return "module service"; + } + return "unknown service"; +} + ModuleManager::ModuleManager() { } @@ -565,6 +585,8 @@ void ModuleManager::AddServices(const ServiceList& list) void ModuleManager::AddService(ServiceProvider& item) { + ServerInstance->Logs->Log("SERVICE", LOG_DEBUG, "Adding %s %s provided by %s", item.name.c_str(), + item.GetTypeString(), item.creator ? item.creator->ModuleSourceFile.c_str() : "the core"); switch (item.service) { case SERVICE_DATA: @@ -592,6 +614,8 @@ void ModuleManager::AddService(ServiceProvider& item) void ModuleManager::DelService(ServiceProvider& item) { + ServerInstance->Logs->Log("SERVICE", LOG_DEBUG, "Deleting %s %s provided by %s", item.name.c_str(), + item.GetTypeString(), item.creator ? item.creator->ModuleSourceFile.c_str() : "the core"); switch (item.service) { case SERVICE_MODE: -- cgit v1.2.3