1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 class ChannelLogStream : public LogStream
22 ChannelLogStream(InspIRCd *Instance, int loglevel, const std::string &chan) : LogStream(Instance, loglevel), channel(chan)
26 virtual void OnLog(int loglevel, const std::string &type, const std::string &msg)
28 Channel *c = ServerInstance->FindChan(channel);
30 if (loglevel < this->loglvl) return;
34 // So this won't work remotely. Oh well.
35 c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :\2%s\2: %s", c->name, type.c_str(), msg.c_str());
40 /* $ModDesc: Logs output to a channel instead of / as well as a file. */
42 class ModuleChanLog : public Module
47 ModuleChanLog(InspIRCd* Me) : Module(Me)
49 l = new ChannelLogStream(Me, ServerInstance->Config->LogLevel, "#services");
50 Me->Logs->AddLogType("*", l);
53 virtual ~ModuleChanLog()
58 virtual Version GetVersion()
60 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
65 MODULE_INIT(ModuleChanLog)