diff options
-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: |