virtual ~LogStream() { }
- virtual void OnLog(int loglevel, const std::string &type, const std::string &msg) { }
+ void ChangeLevel(int lvl) { this->loglvl = lvl; } // For on-the-fly change of loglevel.
+
+ virtual void OnLog(int loglevel, const std::string &type, const std::string &msg) = 0;
};
typedef std::map<FileWriter*, int> FileLogMap;
{
private:
bool Logging; // true when logging, avoids recursion
+ LogStream* noforkstream; // LogStream for nofork.
InspIRCd *ServerInstance;
std::map<std::string, std::vector<LogStream *> > LogStreams;
+ std::map<LogStream *, int> AllLogStreams; // holds all logstreams
std::vector<LogStream *> GlobalLogStreams; //holds all logstreams with a type of *
FileLogMap FileLogs; /* Holds all file logs, refcounted */
public:
Logging = false;
}
+ void SetupNoFork();
+
void AddLoggerRef(FileWriter* fw)
{
FileLogMap::iterator i = FileLogs.find(fw);
void OpenSingleFile(FILE* f, const std::string& type, int loglevel);
void OpenFileLogs();
void CloseLogs();
- bool AddLogType(const std::string &type, LogStream *l);
+ bool AddLogType(const std::string &type, LogStream *l, bool autoclose);
+ void DelLogStream(LogStream* l);
bool DelLogType(const std::string &type, LogStream *l);
void Log(const std::string &type, int loglevel, const std::string &msg);
void Log(const std::string &type, int loglevel, const char *fmt, ...);