X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Flogger.h;h=0e1bab4a3968c0c2317843e1e1dac2ca9a26ab54;hb=db2a4c2c15bb170464bbff464d7cc79cd098df26;hp=d6bd07498d35df79bf5fae6b3d287553ff523ad7;hpb=68e47f5ec2154aa97ff298d4516ca0caf746e51a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/logger.h b/include/logger.h index d6bd07498..0e1bab4a3 100644 --- a/include/logger.h +++ b/include/logger.h @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * InspIRCd: (C) 2002-2010 InspIRCd Development Team * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see @@ -26,13 +26,9 @@ * I/O (linux seems to, as does freebsd) this will default to * blocking behaviour. */ -class CoreExport FileWriter : public EventHandler +class CoreExport FileWriter { protected: - /** The creator/owner of this object - */ - InspIRCd* ServerInstance; - /** The log file (fd is inside this somewhere, * we get it out with fileno()) */ @@ -45,15 +41,7 @@ class CoreExport FileWriter : public EventHandler public: /** The constructor takes an already opened logfile. */ - FileWriter(InspIRCd* Instance, FILE* logfile); - - /** Handle pending write events. - * This will flush any waiting data to disk. - * If any data remains after the fprintf call, - * another write event is scheduled to write - * the rest of the data when possible. - */ - virtual void HandleEvent(EventType et, int errornum = 0); + FileWriter(FILE* logfile); /** Write one or more preformatted log lines. * If the data cannot be written immediately, @@ -64,10 +52,6 @@ class CoreExport FileWriter : public EventHandler */ void WriteLogLine(const std::string &line); - /** Close the log file and cancel any events. - */ - virtual void Close(); - /** Close the log file and cancel any events. */ virtual ~FileWriter(); @@ -96,10 +80,9 @@ class CoreExport FileWriter : public EventHandler class CoreExport LogStream : public classbase { protected: - InspIRCd *ServerInstance; int loglvl; public: - LogStream(InspIRCd *Instance, int loglevel) : ServerInstance(Instance), loglvl(loglevel) + LogStream(int loglevel) : loglvl(loglevel) { } @@ -122,19 +105,13 @@ class CoreExport LogStream : public classbase typedef std::map FileLogMap; -class CoreExport LogManager : public classbase +class CoreExport LogManager { private: /** Lock variable, set to true when a log is in progress, which prevents further loggging from happening and creating a loop. */ bool Logging; - /** LogStream for -nofork, logs to STDOUT when it's active. - */ - LogStream* noforkstream; - - InspIRCd *ServerInstance; - /** Map of active log types and what LogStreams will receive them. */ std::map > LogStreams; @@ -154,24 +131,8 @@ class CoreExport LogManager : public classbase public: - LogManager(InspIRCd *Instance) - { - noforkstream = NULL; - ServerInstance = Instance; - Logging = false; - } - - ~LogManager() - { - if (noforkstream) - delete noforkstream; - } - - /** Sets up the logstream for -nofork. Called by InspIRCd::OpenLog() and LogManager::OpenFileLogs(). - * First time called it creates the nofork stream and stores it in noforkstream. Each call thereafter just readds it to GlobalLogStreams - * and updates the loglevel. - */ - void SetupNoFork(); + LogManager(); + ~LogManager(); /** Adds a FileWriter instance to LogManager, or increments the reference count of an existing instance. * Used for file-stream sharing for FileLogStreams.