From ca2209aaedc6c646063a58261fef2b57276ce4bb Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 5 Sep 2023 00:21:31 +0100 Subject: Show the SQL service name in the db_sql error message. This should help users diagnose issues easier. --- include/service.h | 4 ++++ modules/database/db_sql.cpp | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/service.h b/include/service.h index 34e3c064e..c5c5a5881 100644 --- a/include/service.h +++ b/include/service.h @@ -128,6 +128,10 @@ class ServiceReference : public Reference { } + const Anope::string &GetServiceName() const { return name; } + + const Anope::string &GetServiceType() const { return type; } + inline void operator=(const Anope::string &n) { this->name = n; diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index adb83d1e0..1094fb9a9 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -76,7 +76,7 @@ class DBSQL : public Module, public Pipe if (last_warn + 300 < Anope::CurTime) { last_warn = Anope::CurTime; - Log(this) << "db_sql: Unable to execute query, is SQL configured correctly?"; + Log(this) << "db_sql: Unable to execute query, is SQL (" << this->sql.GetServiceName() << ") configured correctly?"; } } else if (!Anope::Quitting) @@ -174,7 +174,7 @@ class DBSQL : public Module, public Pipe { if (!this->sql) { - Log(this) << "Unable to load databases, is SQL configured correctly?"; + Log(this) << "Unable to load databases, is SQL (" << this->sql.GetServiceName() << ") configured correctly?"; return EVENT_CONTINUE; } -- cgit