diff options
author | Sadie Powell <sadie@witchery.services> | 2020-12-04 15:55:28 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-12-04 15:56:59 +0000 |
commit | eda0e5e2f0509a3eea823f64c4acea8ac970b9a4 (patch) | |
tree | 3436114da177c740471fc01d60726825a857b658 | |
parent | 414e65c75b95dd51e226ef9758e9260197c21da6 (diff) |
Improve the logging of service adding/deleting.
-rw-r--r-- | include/base.h | 3 | ||||
-rw-r--r-- | src/modules.cpp | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/base.h b/include/base.h index cccc130c5..b915d9ae4 100644 --- a/include/base.h +++ b/include/base.h @@ -259,6 +259,9 @@ class CoreExport ServiceProvider : public classbase ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type); virtual ~ServiceProvider(); + /** Retrieves a string that represents the type of this service. */ + const char* GetTypeString() const; + /** Register this service in the appropriate registrar */ virtual void RegisterService(); 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: |