#ifndef LOGGER_H #define LOGGER_H enum LogType { LOG_ADMIN, LOG_OVERRIDE, LOG_COMMAND, LOG_SERVER, LOG_CHANNEL, LOG_USER, LOG_NORMAL, LOG_TERMINAL, LOG_RAWIO, LOG_DEBUG, LOG_DEBUG_2, LOG_DEBUG_3, LOG_DEBUG_4 }; struct LogFile { Anope::string filename; public: std::ofstream stream; LogFile(const Anope::string &name); Anope::string GetName() const; }; class CoreExport Log { public: BotInfo *bi; LogType Type; Anope::string Category; std::list Sources; std::stringstream buf; Log(LogType type = LOG_NORMAL, const Anope::string &category = "", BotInfo *bi = Global); /* LOG_COMMAND/OVERRIDE/ADMIN */ Log(LogType type, User *u, Command *c, ChannelInfo *ci = NULL); /* LOG_CHANNEL */ Log(User *u, Channel *c, const Anope::string &category = ""); /* LOG_USER */ explicit Log(User *u, const Anope::string &category = ""); /* LOG_SERVER */ Log(Server *s, const Anope::string &category = ""); Log(BotInfo *b, const Anope::string &category = ""); ~Log(); template Log &operator<<(T val) { this->buf << val; return *this; } }; class CoreExport LogInfo { public: std::list Targets; std::map Logfiles; std::list Sources; int LogAge; bool Inhabit; std::list Admin; std::list Override; std::list Commands; std::list Servers; std::list Users; std::list Channels; bool Normal; bool RawIO; bool Debug; LogInfo(int logage, bool inhabit, bool normal, bool rawio, bool debug); ~LogInfo(); void AddType(std::list &list, const Anope::string &type); bool HasType(std::list &list, const Anope::string &type) const; std::list &GetList(LogType type); bool HasType(LogType Type); void ProcessMessage(const Log *l); }; #endif // LOGGER_H