summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2023-09-05 00:21:31 +0100
committerSadie Powell <sadie@witchery.services>2023-09-05 00:21:31 +0100
commitca2209aaedc6c646063a58261fef2b57276ce4bb (patch)
tree6002525e5960e50ebbac12f73ca3a91ffe1c388c
parent0a3ddef3151ef4258e529f5850be08810fa146d3 (diff)
Show the SQL service name in the db_sql error message.
This should help users diagnose issues easier.
-rw-r--r--include/service.h4
-rw-r--r--modules/database/db_sql.cpp4
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<T>
{
}
+ 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;
}