summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/logger.h4
-rw-r--r--modules/commands/ms_rsend.cpp2
-rw-r--r--modules/commands/ns_register.cpp2
-rw-r--r--modules/commands/os_defcon.cpp6
-rw-r--r--modules/commands/os_dns.cpp16
-rw-r--r--modules/commands/os_module.cpp2
-rw-r--r--modules/commands/os_reload.cpp2
-rw-r--r--modules/commands/os_session.cpp2
-rw-r--r--modules/database/db_flatfile.cpp8
-rw-r--r--modules/database/db_sql.cpp6
-rw-r--r--modules/extra/bs_autoassign.cpp2
-rw-r--r--modules/extra/m_chanstats.cpp2
-rw-r--r--modules/extra/m_dnsbl.cpp2
-rw-r--r--modules/extra/m_ldap_authentication.cpp20
-rw-r--r--modules/extra/m_ldap_oper.cpp6
-rw-r--r--modules/extra/m_mysql.cpp2
-rw-r--r--modules/extra/m_sql_authentication.cpp4
-rw-r--r--modules/extra/m_sql_oper.cpp10
-rw-r--r--modules/extra/m_ssl.cpp4
-rw-r--r--modules/extra/m_xmlrpc.cpp4
-rw-r--r--src/logger.cpp28
21 files changed, 75 insertions, 59 deletions
diff --git a/include/logger.h b/include/logger.h
index 9b3658e94..5df81a5bc 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -24,6 +24,7 @@ enum LogType
LOG_SERVER,
LOG_CHANNEL,
LOG_USER,
+ LOG_MODULE,
LOG_NORMAL,
LOG_TERMINAL,
LOG_RAWIO,
@@ -56,6 +57,7 @@ class CoreExport Log
Channel *chan;
const ChannelInfo *ci;
Server *s;
+ Module *m;
LogType Type;
Anope::string Category;
std::list<Anope::string> Sources;
@@ -78,6 +80,8 @@ class CoreExport Log
explicit Log(const BotInfo *b, const Anope::string &category = "");
+ Log(Module *m, const Anope::string &category = "");
+
~Log();
Anope::string BuildPrefix() const;
diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp
index 9b6545f7f..9c47b9f53 100644
--- a/modules/commands/ms_rsend.cpp
+++ b/modules/commands/ms_rsend.cpp
@@ -44,7 +44,7 @@ class CommandMSRSend : public Command
source.Reply(ACCESS_DENIED);
else if (Config->MSMemoReceipt > 2 || Config->MSMemoReceipt == 0)
{
- Log() << "MSMemoReceipt is set misconfigured to " << Config->MSMemoReceipt;
+ Log(this->owner) << "MSMemoReceipt is set misconfigured to " << Config->MSMemoReceipt;
source.Reply(_("Sorry, RSEND has been disabled on this network."));
}
else
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index f7675ca60..0413f8cc8 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -307,7 +307,7 @@ class CommandNSResend : public Command
Log(LOG_COMMAND, source, this) << "to resend registration verification code";
}
else
- Log() << "Unable to resend registration verification code for " << source.GetNick();
+ Log(this->owner) << "Unable to resend registration verification code for " << source.GetNick();
}
return;
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp
index 1d684bc27..ad08ba77c 100644
--- a/modules/commands/os_defcon.cpp
+++ b/modules/commands/os_defcon.cpp
@@ -282,7 +282,7 @@ class OSDefcon : public Module
{
if (cm->Type == MODE_STATUS || cm->Type == MODE_LIST || !cm->CanSet(NULL))
{
- Log() << "DefConChanModes mode character '" << mode << "' cannot be locked";
+ Log(this) << "DefConChanModes mode character '" << mode << "' cannot be locked";
continue;
}
else if (add)
@@ -296,7 +296,7 @@ class OSDefcon : public Module
if (!ss.GetToken(param))
{
- Log() << "DefConChanModes mode character '" << mode << "' has no parameter while one is expected";
+ Log(this) << "DefConChanModes mode character '" << mode << "' has no parameter while one is expected";
continue;
}
@@ -321,7 +321,7 @@ class OSDefcon : public Module
{
DConfig.DefConModesOn.UnsetFlag(CMODE_REDIRECT);
- Log() << "DefConChanModes must lock mode +l as well to lock mode +L";
+ Log(this) << "DefConChanModes must lock mode +l as well to lock mode +L";
}
}
diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp
index d0a56e1e4..e304050b3 100644
--- a/modules/commands/os_dns.cpp
+++ b/modules/commands/os_dns.cpp
@@ -430,7 +430,7 @@ class ModuleDNS : public Module
if (dns && !dns->Pooled() && !dns->GetIPs().empty() && dns->GetLimit() < s->Users)
{
dns->Pool(true);
- Log() << "Pooling server " << s->GetName();
+ Log(this) << "Pooling server " << s->GetName();
}
}
}
@@ -442,7 +442,7 @@ class ModuleDNS : public Module
if (dns && dns->Pooled())
{
dns->Pool(false);
- Log() << "Depooling delinked server " << s->GetName();
+ Log(this) << "Depooling delinked server " << s->GetName();
}
}
@@ -454,7 +454,7 @@ class ModuleDNS : public Module
/* Check for user limit reached */
if (s && s->GetLimit() && s->Pooled() && u->server->Users >= s->GetLimit())
{
- Log() << "Depooling full server " << s->GetName() << ": " << u->server->Users << " users";
+ Log(this) << "Depooling full server " << s->GetName() << ": " << u->server->Users << " users";
s->Pool(false);
}
}
@@ -471,7 +471,7 @@ class ModuleDNS : public Module
/* Check for dropping under userlimit */
if (s->GetLimit() && !s->Pooled() && s->GetLimit() > u->server->Users)
{
- Log() << "Pooling server " << s->GetName();
+ Log(this) << "Pooling server " << s->GetName();
s->Pool(true);
}
@@ -489,7 +489,7 @@ class ModuleDNS : public Module
/* Check for very fast user drops */
if (diff <= this->user_drop_time)
{
- Log() << "Depooling server " << s->GetName() << ": dropped " << this->user_drop_mark << " users in " << diff << " seconds";
+ Log(this) << "Depooling server " << s->GetName() << ": dropped " << this->user_drop_mark << " users in " << diff << " seconds";
s->repool = Anope::CurTime + this->user_drop_readd_time;
s->Pool(false);
}
@@ -498,7 +498,7 @@ class ModuleDNS : public Module
{
s->Pool(true);
s->repool = 0;
- Log() << "Pooling server " << s->GetName();
+ Log(this) << "Pooling server " << s->GetName();
}
}
}
@@ -540,7 +540,7 @@ class ModuleDNS : public Module
if (last_warn + 60 < Anope::CurTime)
{
last_warn = Anope::CurTime;
- Log() << "os_dns: Warning! There are no pooled servers!";
+ Log(this) << "os_dns: Warning! There are no pooled servers!";
}
/* Something messed up, just return them all and hope one is available */
@@ -564,7 +564,7 @@ class ModuleDNS : public Module
if (packet->answers.empty())
{
- Log() << "os_dns: Error! There are no servers with any IPs. At all.";
+ Log(this) << "os_dns: Error! There are no servers with any IPs. At all.";
/* Send back an empty answer anyway */
}
}
diff --git a/modules/commands/os_module.cpp b/modules/commands/os_module.cpp
index 1d3c1d30a..e7e0e2c16 100644
--- a/modules/commands/os_module.cpp
+++ b/modules/commands/os_module.cpp
@@ -141,7 +141,7 @@ class CommandOSModUnLoad : public Command
return;
}
- Log() << "Trying to unload module [" << mname << "]";
+ Log(this->owner) << "Trying to unload module [" << mname << "]";
ModuleReturn status = ModuleManager::UnloadModule(m, source.GetUser());
diff --git a/modules/commands/os_reload.cpp b/modules/commands/os_reload.cpp
index 8b7da60f9..e7a07054f 100644
--- a/modules/commands/os_reload.cpp
+++ b/modules/commands/os_reload.cpp
@@ -36,7 +36,7 @@ class CommandOSReload : public Command
catch (const ConfigException &ex)
{
Config = old_config;
- Log() << "Error reloading configuration file: " << ex.GetReason();
+ Log(this->owner) << "Error reloading configuration file: " << ex.GetReason();
source.Reply(_("Error reloading configuration file: ") + ex.GetReason());
}
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index a1396f293..ef11462b8 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -689,7 +689,7 @@ class OSSession : public Module
if (!session)
{
if (debug)
- Log() << "session: Tried to delete non-existant session: " << u->host;
+ Log(this) << "Tried to delete non-existant session: " << u->host;
return;
}
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp
index 4649a3666..2b31c8a81 100644
--- a/modules/database/db_flatfile.cpp
+++ b/modules/database/db_flatfile.cpp
@@ -55,7 +55,7 @@ class DBFlatFile : public Module
Log(LOG_DEBUG) << "db_flatfile: Attemping to rename " << DatabaseFile << " to " << newname;
if (rename(DatabaseFile.c_str(), newname.c_str()))
{
- Log() << "Unable to back up database!";
+ Log(this) << "Unable to back up database!";
if (!Config->NoBackupOkay)
quitting = true;
@@ -88,7 +88,7 @@ class DBFlatFile : public Module
if (!databases[NULL]->is_open())
{
delete databases[NULL];
- Log() << "Unable to open " << DatabaseFile << " for reading!";
+ Log(this) << "Unable to open " << DatabaseFile << " for reading!";
return EVENT_CONTINUE;
}
@@ -168,7 +168,7 @@ class DBFlatFile : public Module
if (!databases[NULL]->is_open())
{
delete databases[NULL];
- Log() << "Unable to open " << DatabaseFile << " for writing";
+ Log(this) << "Unable to open " << DatabaseFile << " for writing";
if (IsFile(tmp_db))
rename(tmp_db.c_str(), DatabaseFile.c_str());
return EVENT_CONTINUE;
@@ -200,7 +200,7 @@ class DBFlatFile : public Module
if (databases[NULL]->good() == false)
{
- Log() << "Unable to write database";
+ Log(this) << "Unable to write database";
databases[NULL]->close();
if (!Config->NoBackupOkay)
quitting = true;
diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp
index acc59b668..48c813a3c 100644
--- a/modules/database/db_sql.cpp
+++ b/modules/database/db_sql.cpp
@@ -69,7 +69,7 @@ class DBSQL : public Module, public Pipe
if (last_warn + 300 < Anope::CurTime)
{
last_warn = Anope::CurTime;
- Log() << "db_sql: Unable to execute query, is SQL configured correctly?";
+ Log(this) << "db_sql: Unable to execute query, is SQL configured correctly?";
}
}
else if (!quitting)
@@ -146,7 +146,7 @@ class DBSQL : public Module, public Pipe
{
if (!this->sql)
{
- Log() << "db_sql: Unable to load databases, is SQL configured correctly?";
+ Log(this) << "Unable to load databases, is SQL configured correctly?";
return EVENT_CONTINUE;
}
@@ -174,7 +174,7 @@ class DBSQL : public Module, public Pipe
}
catch (const ConvertException &)
{
- Log() << "db_sql: Unable to convert id for object #" << j << " of type " << sb->GetName();
+ Log(this) << "Unable to convert id for object #" << j << " of type " << sb->GetName();
}
}
}
diff --git a/modules/extra/bs_autoassign.cpp b/modules/extra/bs_autoassign.cpp
index be4b58cf9..f290a3856 100644
--- a/modules/extra/bs_autoassign.cpp
+++ b/modules/extra/bs_autoassign.cpp
@@ -34,7 +34,7 @@ class BSAutoAssign : public Module
BotInfo *bi = findbot(this->bot);
if (bi == NULL)
{
- Log() << "bs_autoassign is configured to assign bot " << this->bot << ", but it does not exist?";
+ Log(this) << "bs_autoassign is configured to assign bot " << this->bot << ", but it does not exist?";
return;
}
diff --git a/modules/extra/m_chanstats.cpp b/modules/extra/m_chanstats.cpp
index 9d9e9dbd8..1c37aa8ec 100644
--- a/modules/extra/m_chanstats.cpp
+++ b/modules/extra/m_chanstats.cpp
@@ -363,7 +363,7 @@ class MChanstats : public Module
if (sql)
this->CheckTables();
else
- Log() << "Chanstats: no database connection to " << engine;
+ Log(this) << "no database connection to " << engine;
}
void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) anope_override
{
diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp
index ed9776e84..b860bd64c 100644
--- a/modules/extra/m_dnsbl.cpp
+++ b/modules/extra/m_dnsbl.cpp
@@ -163,7 +163,7 @@ class ModuleDNSBL : public Module
}
catch (const SocketException &ex)
{
- Log() << "m_dnsbl: " << ex.GetReason();
+ Log(this) << ex.GetReason();
}
}
}
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index 5469713e2..f2140eb71 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -75,7 +75,7 @@ class IdentifyInterface : public LDAPInterface
}
catch (const LDAPException &ex)
{
- Log() << "m_ldap_authentication: Error binding after search: " << ex.GetReason();
+ Log(this->owner) << "m_ldap_authentication: Error binding after search: " << ex.GetReason();
}
}
break;
@@ -95,7 +95,7 @@ class IdentifyInterface : public LDAPInterface
}
catch (const LDAPException &ex)
{
- Log() << "m_ldap_authentication: Unable to search for " << sf << ": " << ex.GetReason();
+ Log(this->owner) << "m_ldap_authentication: Unable to search for " << sf << ": " << ex.GetReason();
}
}
else
@@ -172,19 +172,19 @@ class OnIdentifyInterface : public LDAPInterface
BotInfo *bi = findbot(Config->NickServ);
if (bi)
u->SendMessage(bi, _("Your email has been updated to \002%s\002"), email.c_str());
- Log() << "m_ldap_authentication: Updated email address for " << u->nick << " (" << u->Account()->display << ") to " << email;
+ Log(this->owner) << "m_ldap_authentication: Updated email address for " << u->nick << " (" << u->Account()->display << ") to " << email;
}
}
catch (const LDAPException &ex)
{
- Log() << "m_ldap_authentication: " << ex.GetReason();
+ Log(this->owner) << "m_ldap_authentication: " << ex.GetReason();
}
}
void OnError(const LDAPResult &r) anope_override
{
this->requests.erase(r.id);
- Log() << "m_ldap_authentication: " << r.error;
+ Log(this->owner) << "m_ldap_authentication: " << r.error;
}
};
@@ -195,12 +195,12 @@ class OnRegisterInterface : public LDAPInterface
void OnResult(const LDAPResult &r) anope_override
{
- Log() << "m_ldap_authentication: Successfully added newly created account to LDAP";
+ Log(this->owner) << "m_ldap_authentication: Successfully added newly created account to LDAP";
}
void OnError(const LDAPResult &r) anope_override
{
- Log() << "m_ldap_authentication: Error adding newly created account to LDAP: " << r.getError();
+ Log(this->owner) << "m_ldap_authentication: Error adding newly created account to LDAP: " << r.getError();
}
};
@@ -268,7 +268,7 @@ class NSIdentifyLDAP : public Module
catch (const LDAPException &ex)
{
delete ii;
- Log() << "m_ldap_authentication: " << ex.GetReason();
+ Log(this) << ex.GetReason();
}
}
@@ -288,7 +288,7 @@ class NSIdentifyLDAP : public Module
}
catch (const LDAPException &ex)
{
- Log() << "m_ldap_authentication: " << ex.GetReason();
+ Log(this) << ex.GetReason();
}
}
@@ -325,7 +325,7 @@ class NSIdentifyLDAP : public Module
}
catch (const LDAPException &ex)
{
- Log() << "m_ldap_authentication: " << ex.GetReason();
+ Log(this) << ex.GetReason();
}
}
};
diff --git a/modules/extra/m_ldap_oper.cpp b/modules/extra/m_ldap_oper.cpp
index 4f1784553..53b3d4d43 100644
--- a/modules/extra/m_ldap_oper.cpp
+++ b/modules/extra/m_ldap_oper.cpp
@@ -50,7 +50,7 @@ class IdentifyInterface : public LDAPInterface
o = new Oper(u->nick, ot);
my_opers.insert(o);
nc->o = o;
- Log() << "m_ldap_oper: Tied " << u->nick << " (" << nc->display << ") to opertype " << ot->GetName();
+ Log(this->owner) << "m_ldap_oper: Tied " << u->nick << " (" << nc->display << ") to opertype " << ot->GetName();
}
}
catch (const LDAPException &ex)
@@ -64,7 +64,7 @@ class IdentifyInterface : public LDAPInterface
}
nc->o = NULL;
- Log() << "m_ldap_oper: Removed services operator from " << u->nick << " (" << nc->display << ")";
+ Log() << "Removed services operator from " << u->nick << " (" << nc->display << ")";
}
}
}
@@ -127,7 +127,7 @@ class LDAPOper : public Module
}
catch (const LDAPException &ex)
{
- Log() << "m_ldapoper: " << ex.GetReason();
+ Log() << ex.GetReason();
}
}
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp
index 94bc51a0f..7f1f965cd 100644
--- a/modules/extra/m_mysql.cpp
+++ b/modules/extra/m_mysql.cpp
@@ -53,7 +53,7 @@ class MySQLResult : public SQLResult
{
unsigned num_fields = res ? mysql_num_fields(res) : 0;
- /* It is not thread safe to log anything here using Log() now :( */
+ /* It is not thread safe to log anything here using Log(this->owner) now :( */
if (!num_fields)
return;
diff --git a/modules/extra/m_sql_authentication.cpp b/modules/extra/m_sql_authentication.cpp
index 9375615ee..9412edc50 100644
--- a/modules/extra/m_sql_authentication.cpp
+++ b/modules/extra/m_sql_authentication.cpp
@@ -65,7 +65,7 @@ class SQLAuthenticationResult : public SQLInterface
void OnError(const SQLResult &r) anope_override
{
- Log() << "m_sql_authentication: Error executing query " << r.GetQuery().query << ": " << r.GetError();
+ Log(this->owner) << "m_sql_authentication: Error executing query " << r.GetQuery().query << ": " << r.GetError();
delete this;
}
};
@@ -119,7 +119,7 @@ class ModuleSQLAuthentication : public Module
{
if (!this->SQL)
{
- Log() << "m_sql_authentication: Unable to find SQL engine";
+ Log(this) << "Unable to find SQL engine";
return;
}
diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp
index b834e26ca..22218a646 100644
--- a/modules/extra/m_sql_oper.cpp
+++ b/modules/extra/m_sql_oper.cpp
@@ -50,7 +50,7 @@ class SQLOperResult : public SQLInterface
Config->Opers.erase(it);
delete user->Account()->o;
user->Account()->o = NULL;
- Log() << "m_sql_oper: Removed services operator from " << user->nick << " (" << user->Account()->display << ")";
+ Log(this->owner) << "m_sql_oper: Removed services operator from " << user->nick << " (" << user->Account()->display << ")";
user->RemoveMode(findbot(Config->OperServ), UMODE_OPER); // Probably not set, just incase
}
return;
@@ -59,13 +59,13 @@ class SQLOperResult : public SQLInterface
OperType *ot = OperType::Find(opertype);
if (ot == NULL)
{
- Log() << "m_sql_oper: Oper " << user->nick << " has type " << opertype << ", but this opertype does not exist?";
+ Log(this->owner) << "m_sql_oper: Oper " << user->nick << " has type " << opertype << ", but this opertype does not exist?";
return;
}
if (!user->Account()->o || user->Account()->o->ot != ot)
{
- Log() << "m_sql_oper: Tieing oper " << user->nick << " to type " << opertype;
+ Log(this->owner) << "m_sql_oper: Tieing oper " << user->nick << " to type " << opertype;
user->Account()->o = new Oper(user->Account()->display, ot);
Config->Opers.push_back(user->Account()->o);
}
@@ -82,7 +82,7 @@ class SQLOperResult : public SQLInterface
void OnError(const SQLResult &r) anope_override
{
SQLOperResultDeleter d(this);
- Log() << "m_sql_oper: Error executing query " << r.GetQuery().query << ": " << r.GetError();
+ Log(this->owner) << "m_sql_oper: Error executing query " << r.GetQuery().query << ": " << r.GetError();
}
};
@@ -118,7 +118,7 @@ class ModuleSQLOper : public Module
{
if (!this->SQL)
{
- Log() << "m_sql_oper: Unable to find SQL engine";
+ Log() << "Unable to find SQL engine";
return;
}
diff --git a/modules/extra/m_ssl.cpp b/modules/extra/m_ssl.cpp
index 86373fd7c..adae7a6fe 100644
--- a/modules/extra/m_ssl.cpp
+++ b/modules/extra/m_ssl.cpp
@@ -122,7 +122,7 @@ class SSLModule : public Module
Log(LOG_DEBUG) << "m_ssl: Successfully loaded certificate " << this->certfile;
}
else
- Log() << "m_ssl: Unable to open certificate " << this->certfile;
+ Log() << "Unable to open certificate " << this->certfile;
if (IsFile(this->keyfile.c_str()))
{
@@ -144,7 +144,7 @@ class SSLModule : public Module
throw ModuleException("Error loading private key " + this->keyfile + " - file not found");
}
else
- Log() << "m_ssl: Unable to open private key " << this->keyfile;
+ Log() << "Unable to open private key " << this->keyfile;
}
SSL_CTX_set_mode(client_ctx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
diff --git a/modules/extra/m_xmlrpc.cpp b/modules/extra/m_xmlrpc.cpp
index a804c35d2..ad1c2756b 100644
--- a/modules/extra/m_xmlrpc.cpp
+++ b/modules/extra/m_xmlrpc.cpp
@@ -286,7 +286,7 @@ class ModuleXMLRPC : public Module
if (ssl && !sslref)
{
- Log() << "m_xmlrpc: Could not enable SSL, is m_ssl loaded?";
+ Log(this) << "Could not enable SSL, is m_ssl loaded?";
ssl = false;
}
@@ -298,7 +298,7 @@ class ModuleXMLRPC : public Module
}
catch (const SocketException &ex)
{
- Log() << "m_xmlrpc " << ex.GetReason();
+ Log(this) << ex.GetReason();
}
}
}
diff --git a/src/logger.cpp b/src/logger.cpp
index 6a5e1594b..fe3f6f83d 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -79,7 +79,7 @@ Log::Log(LogType type, const Anope::string &category, const BotInfo *b) : bi(b),
this->Sources.push_back(bi->nick);
}
-Log::Log(LogType type, CommandSource &source, Command *_c, const ChannelInfo *_ci) : nick(source.GetNick()), u(source.GetUser()), nc(source.nc), c(_c), chan(NULL), ci(_ci), s(NULL), Type(type)
+Log::Log(LogType type, CommandSource &source, Command *_c, const ChannelInfo *_ci) : nick(source.GetNick()), u(source.GetUser()), nc(source.nc), c(_c), chan(NULL), ci(_ci), s(NULL), m(NULL), Type(type)
{
if (!c)
throw CoreException("Invalid pointers passed to Log::Log");
@@ -103,7 +103,7 @@ Log::Log(LogType type, CommandSource &source, Command *_c, const ChannelInfo *_c
this->Sources.push_back(ci->name);
}
-Log::Log(const User *_u, Channel *ch, const Anope::string &category) : bi(NULL), u(_u), nc(NULL), c(NULL), chan(ch), ci(chan ? *chan->ci : NULL), s(NULL), Type(LOG_CHANNEL)
+Log::Log(const User *_u, Channel *ch, const Anope::string &category) : bi(NULL), u(_u), nc(NULL), c(NULL), chan(ch), ci(chan ? *chan->ci : NULL), s(NULL), m(NULL), Type(LOG_CHANNEL)
{
if (!chan)
throw CoreException("Invalid pointers passed to Log::Log");
@@ -118,7 +118,7 @@ Log::Log(const User *_u, Channel *ch, const Anope::string &category) : bi(NULL),
this->Sources.push_back(chan->name);
}
-Log::Log(const User *_u, const Anope::string &category, const BotInfo *_bi) : bi(_bi), u(_u), nc(NULL), c(NULL), chan(NULL), ci(NULL), s(NULL), Type(LOG_USER), Category(category)
+Log::Log(const User *_u, const Anope::string &category, const BotInfo *_bi) : bi(_bi), u(_u), nc(NULL), c(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), Type(LOG_USER), Category(category)
{
if (!u)
throw CoreException("Invalid pointers passed to Log::Log");
@@ -130,7 +130,7 @@ Log::Log(const User *_u, const Anope::string &category, const BotInfo *_bi) : bi
this->Sources.push_back(u->nick);
}
-Log::Log(Server *serv, const Anope::string &category, const BotInfo *_bi) : bi(_bi), u(NULL), nc(NULL), c(NULL), chan(NULL), ci(NULL), s(serv), Type(LOG_SERVER), Category(category)
+Log::Log(Server *serv, const Anope::string &category, const BotInfo *_bi) : bi(_bi), u(NULL), nc(NULL), c(NULL), chan(NULL), ci(NULL), s(serv), m(NULL), Type(LOG_SERVER), Category(category)
{
if (!s)
throw CoreException("Invalid pointer passed to Log::Log");
@@ -144,7 +144,7 @@ Log::Log(Server *serv, const Anope::string &category, const BotInfo *_bi) : bi(_
this->Sources.push_back(s->GetName());
}
-Log::Log(const BotInfo *b, const Anope::string &category) : bi(b), u(NULL), nc(NULL), c(NULL), chan(NULL), ci(NULL), s(NULL), Type(LOG_NORMAL), Category(category)
+Log::Log(const BotInfo *b, const Anope::string &category) : bi(b), u(NULL), nc(NULL), c(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), Type(LOG_NORMAL), Category(category)
{
if (!this->bi && Config)
this->bi = findbot(Config->Global);
@@ -152,6 +152,12 @@ Log::Log(const BotInfo *b, const Anope::string &category) : bi(b), u(NULL), nc(N
this->Sources.push_back(bi->nick);
}
+Log::Log(Module *mod, const Anope::string &category) : bi(NULL), u(NULL), nc(NULL), c(NULL), chan(NULL), ci(NULL), s(NULL), m(mod), Type(LOG_MODULE), Category(category)
+{
+ if (m)
+ this->Sources.push_back(m->name);
+}
+
Log::~Log()
{
if (nofork && debug && this->Type >= LOG_NORMAL && this->Type <= LOG_DEBUG + debug - 1)
@@ -244,6 +250,12 @@ Anope::string Log::BuildPrefix() const
buffer += "SERVER: " + this->s->GetName() + " (" + this->s->GetDescription() + ") ";
break;
}
+ case LOG_MODULE:
+ {
+ if (this->m)
+ buffer += this->m->name.upper() + ": ";
+ break;
+ }
default:
break;
}
@@ -305,16 +317,16 @@ bool LogInfo::HasType(LogType ltype, const Anope::string &type) const
case LOG_USER:
list = &this->Users;
break;
- case LOG_NORMAL:
- list = &this->Normal;
- break;
case LOG_TERMINAL:
return true;
case LOG_RAWIO:
return debug ? true : this->RawIO;
case LOG_DEBUG:
return debug ? true : this->Debug;
+ case LOG_MODULE:
+ case LOG_NORMAL:
default:
+ list = &this->Normal;
break;
}