]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/logger.h
Remove more classbase
[user/henk/code/inspircd.git] / include / logger.h
index 384e38c1a7c022aabcf4fdf8b7407aad15d71a90..4914e86a2fe992acd3e90281bbf7609b72b52d3f 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
 class CoreExport FileWriter : public EventHandler
 {
  protected:
-       /** The creator/owner of this object
-        */
-       InspIRCd* ServerInstance;
-
        /** The log file (fd is inside this somewhere,
         * we get it out with fileno())
         */
        FILE* log;
 
-       /** Buffer of pending log lines to be written
-        */
-       std::string buffer;
-
        /** Number of write operations that have occured
         */
        int writeops;
@@ -49,11 +41,7 @@ class CoreExport FileWriter : public EventHandler
  public:
        /** The constructor takes an already opened logfile.
         */
-       FileWriter(InspIRCd* Instance, FILE* logfile);
-
-       /** This returns false, logfiles are writeable.
-        */
-       virtual bool Readable();
+       FileWriter(FILE* logfile);
 
        /** Handle pending write events.
         * This will flush any waiting data to disk.
@@ -77,7 +65,6 @@ class CoreExport FileWriter : public EventHandler
        virtual void Close();
 
        /** Close the log file and cancel any events.
-        * (indirectly call Close()
         */
        virtual ~FileWriter();
 };
@@ -105,10 +92,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)
        {
        }
 
@@ -131,7 +117,7 @@ class CoreExport LogStream : public classbase
 
 typedef std::map<FileWriter*, int> 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.
@@ -142,8 +128,6 @@ class CoreExport LogManager : public classbase
         */
        LogStream* noforkstream;
 
-       InspIRCd *ServerInstance;
-
        /** Map of active log types and what LogStreams will receive them.
         */
        std::map<std::string, std::vector<LogStream *> > LogStreams;
@@ -163,13 +147,19 @@ class CoreExport LogManager : public classbase
 
  public:
 
-       LogManager(InspIRCd *Instance)
+       LogManager()
        {
                noforkstream = NULL;
-               ServerInstance = Instance;
                Logging = false;
        }
 
+       ~LogManager()
+       {
+               if (noforkstream)
+                       delete noforkstream;
+               Logging = true;
+       }
+
        /** 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.