summaryrefslogtreecommitdiff
path: root/modules/database
diff options
context:
space:
mode:
Diffstat (limited to 'modules/database')
-rw-r--r--modules/database/flatfile.cpp2
-rw-r--r--modules/database/old.cpp20
-rw-r--r--modules/database/redis.cpp28
-rw-r--r--modules/database/sql.cpp2
4 files changed, 28 insertions, 24 deletions
diff --git a/modules/database/flatfile.cpp b/modules/database/flatfile.cpp
index 2f9d0f209..27a51539c 100644
--- a/modules/database/flatfile.cpp
+++ b/modules/database/flatfile.cpp
@@ -765,7 +765,7 @@ class DBFlatFile : public Module
std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary);
if (!fd.is_open())
{
- Log(this) << "Unable to open " << db_name << " for reading!";
+ logger.Log("Unable to open {0} for reading!", db_name);
return EVENT_STOP;
}
diff --git a/modules/database/old.cpp b/modules/database/old.cpp
index ef93aec66..894b9125b 100644
--- a/modules/database/old.cpp
+++ b/modules/database/old.cpp
@@ -355,7 +355,7 @@ static dbFILE *open_db_read(const char *service, const char *filename, int versi
fp = fopen(f->filename, "rb");
if (!fp)
{
- Log() << "Can't read " << service << " database " << f->filename;
+ Anope::Logger.Log("Can't read {0} database {1}", service, f->filename);
delete f;
return NULL;
}
@@ -363,13 +363,13 @@ static dbFILE *open_db_read(const char *service, const char *filename, int versi
myversion = fgetc(fp) << 24 | fgetc(fp) << 16 | fgetc(fp) << 8 | fgetc(fp);
if (feof(fp))
{
- Log() << "Error reading version number on " << f->filename << ": End of file detected.";
+ Anope::Logger.Log("Error reading version number on {0}: End of file detected.", f->filename);
delete f;
return NULL;
}
else if (myversion < version)
{
- Log() << "Unsuported database version (" << myversion << ") on " << f->filename << ".";
+ Anope::Logger.Log("Unsuported database version ({0}) on {1}.", myversion, f->filename);
delete f;
return NULL;
}
@@ -644,7 +644,7 @@ static void LoadNicks()
READ(read_uint16(&u16, f));
READ(read_int16(&i16, f));
- Log(LOG_DEBUG) << "Loaded NickServ::Account " << nc->GetDisplay();
+ Anope::Logger.Debug("Loaded nickserv account {0}", nc->GetDisplay());
}
for (int i = 0; i < 1024; ++i)
@@ -672,7 +672,7 @@ static void LoadNicks()
NickServ::Account *nc = NickServ::FindAccount(core);
if (nc == NULL)
{
- Log() << "Skipping coreless nick " << nick << " with core " << core;
+ Anope::Logger.Debug("Skipping coreless nick {0} with core {1}", nick, core);
continue;
}
@@ -709,7 +709,7 @@ static void LoadNicks()
if (tmpu16 & OLD_NS_NO_EXPIRE)
na->SetNoExpire(true);
- Log(LOG_DEBUG) << "Loaded NickServ::Nick " << na->GetNick();
+ Anope::Logger.Debug("Loaded nick {0}", na->GetNick());
}
close_db(f); /* End of section Ia */
@@ -735,7 +735,7 @@ static void LoadVHosts()
NickServ::Nick *na = NickServ::FindNick(nick);
if (na == NULL)
{
- Log() << "Removing vhost for non-existent nick " << nick;
+ Anope::Logger.Log("Removing vhost for non-existent nick {0}", nick);
continue;
}
@@ -749,7 +749,7 @@ static void LoadVHosts()
vhost->SetCreator(creator);
vhost->SetCreated(vtime);
- Log() << "Loaded vhost for " << na->GetNick();
+ Anope::Logger.Debug("Loaded vhost for {0}", na->GetNick());
}
close_db(f);
@@ -787,7 +787,7 @@ static void LoadBots()
if (flags & OLD_BI_PRIVATE)
bi->bi->SetOperOnly(true);
- Log(LOG_DEBUG) << "Loaded bot " << bi->nick;
+ Anope::Logger.Debug("Loaded bot {0}", bi->nick);
}
close_db(f);
@@ -1173,7 +1173,7 @@ static void LoadChannels()
continue;
}
- Log(LOG_DEBUG) << "Loaded channel " << ci->GetName();
+ Anope::Logger.Debug("Loaded channel {0}", ci->GetName());
}
close_db(f);
diff --git a/modules/database/redis.cpp b/modules/database/redis.cpp
index 49ab8cbd4..b6ce95241 100644
--- a/modules/database/redis.cpp
+++ b/modules/database/redis.cpp
@@ -278,7 +278,7 @@ void TypeLoader::OnResult(const Reply &r)
Serialize::Object *obj = type->Require(id);
if (obj == nullptr)
{
- Log(LOG_DEBUG) << "redis: Unable to require object #" << id << " of type " << type->GetName();
+ Anope::Logger.Debug("Unable to require object #{0} of type {1}", id, type->GetName());
continue;
}
@@ -318,7 +318,7 @@ void ObjectLoader::OnResult(const Reply &r)
void FieldLoader::OnResult(const Reply &r)
{
- Log(LOG_DEBUG_2) << "redis: Setting field " << field->serialize_name << " of object #" << obj->id << " of type " << obj->GetSerializableType()->GetName() << " to " << r.bulk;
+ Anope::Logger.Debug2("Setting field {0} of object #{1} of type {2} to {3}", field->serialize_name, obj->id, obj->GetSerializableType()->GetName(), r.bulk);
field->UnserializeFromString(obj, r.bulk);
delete this;
@@ -358,25 +358,27 @@ void SubscriptionListener::OnResult(const Reply &r)
}
catch (const ConvertException &ex)
{
- Log(LOG_DEBUG) << "redis: unable to get id for SL update key " << sid;
+ this->GetOwner()->logger.Debug("unable to get id for SL update key {0}", sid);
return;
}
Serialize::Object *obj = Serialize::GetID(id);
if (obj == nullptr)
{
- Log(LOG_DEBUG) << "redis: pmessage for unknown object #" << id;
+ this->GetOwner()->logger.Debug("message for unknown object #{0}", id);
return;
}
Serialize::FieldBase *field = obj->GetSerializableType()->GetField(key);
if (field == nullptr)
{
- Log(LOG_DEBUG) << "redis: pmessage for unknown field of object #" << id << ": " << key;
+ this->GetOwner()->logger.Debug("message for unknown field of object #{0}: {1}", id, key);
return;
}
- Log(LOG_DEBUG_2) << "redis: Setting field " << field->serialize_name << " of object #" << obj->id << " of type " << obj->GetSerializableType()->GetName() << " to " << value;
+ this->GetOwner()->logger.Debug2("Setting field {0} of object #{1} of type {2} to {3}",
+ field->serialize_name, obj->id, obj->GetSerializableType()->GetName(), value);
+
field->UnserializeFromString(obj, value);
}
else if (command == "create")
@@ -393,21 +395,21 @@ void SubscriptionListener::OnResult(const Reply &r)
}
catch (const ConvertException &ex)
{
- Log(LOG_DEBUG) << "redis: unable to get id for SL update key " << sid;
+ this->GetOwner()->logger.Debug("unable to get id for SL update key {0}", sid);
return;
}
Serialize::TypeBase *type = Serialize::TypeBase::Find(stype);
if (type == nullptr)
{
- Log(LOG_DEBUG) << "redis: pmessage create for nonexistant type " << stype;
+ this->GetOwner()->logger.Debug("message create for nonexistant type {0}", stype);
return;
}
Serialize::Object *obj = type->Require(id);
if (obj == nullptr)
{
- Log(LOG_DEBUG) << "redis: require for pmessage create type " << type->GetName() << " id #" << id << " returned nullptr";
+ this->GetOwner()->logger.Debug("require for message create type {0} id #{1} returned nullptr", type->GetName(), id);
return;
}
}
@@ -424,21 +426,23 @@ void SubscriptionListener::OnResult(const Reply &r)
}
catch (const ConvertException &ex)
{
- Log(LOG_DEBUG) << "redis: unable to get id for SL update key " << sid;
+ this->GetOwner()->logger.Debug("unable to get id for SL update key {0}", sid);
return;
}
Serialize::Object *obj = Serialize::GetID(id);
if (obj == nullptr)
{
- Log(LOG_DEBUG) << "redis: message for unknown object #" << id;
+ this->GetOwner()->logger.Debug("message for unknown object #{0}", id);
return;
}
obj->Delete();
}
else
- Log(LOG_DEBUG) << "redis: unknown message: " << message;
+ {
+ this->GetOwner()->logger.Debug("unknown message: {0}", message);
+ }
}
MODULE_INIT(DatabaseRedis)
diff --git a/modules/database/sql.cpp b/modules/database/sql.cpp
index 1739f168d..00c45a4bc 100644
--- a/modules/database/sql.cpp
+++ b/modules/database/sql.cpp
@@ -176,7 +176,7 @@ class DBSQL : public Module, public Pipe
Serialize::Object *other = type->Require(id);
if (other == nullptr)
{
- Log(LOG_DEBUG) << "Unable to require id " << id << " type " << type->GetName();
+ Anope::Logger.Debug("Unable to require id {0} type {1}", id, type->GetName());
continue;
}