]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/logger.h
Fixes for bug #12
[user/henk/code/inspircd.git] / include / logger.h
index 709d00aed92bd28d1784995f58e45ba52b81d930..6168bedefdf1513cecdef27c4f5b5b200c1035f2 100644 (file)
@@ -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
@@ -11,8 +11,8 @@
  * ---------------------------------------------------
  */
 
-#ifndef __LOGMANAGER_H
-#define __LOGMANAGER_H
+#ifndef LOGMANAGER_H
+#define LOGMANAGER_H
 
 /** This class implements a nonblocking writer.
  * Most people writing an ircd give little thought to their disk
@@ -26,7 +26,7 @@
  * I/O (linux seems to, as does freebsd) this will default to
  * blocking behaviour.
  */
-class CoreExport FileWriter : public EventHandler
+class CoreExport FileWriter
 {
  protected:
        /** The log file (fd is inside this somewhere,
@@ -43,14 +43,6 @@ class CoreExport FileWriter : public EventHandler
         */
        FileWriter(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);
-
        /** Write one or more preformatted log lines.
         * If the data cannot be written immediately,
         * this class will insert itself into the
@@ -60,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();
@@ -117,17 +105,13 @@ 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.
         */
        bool Logging;
 
-       /** LogStream for -nofork, logs to STDOUT when it's active.
-        */
-       LogStream* noforkstream;
-
        /** Map of active log types and what LogStreams will receive them.
         */
        std::map<std::string, std::vector<LogStream *> > LogStreams;
@@ -147,24 +131,8 @@ class CoreExport LogManager : public classbase
 
  public:
 
-       LogManager()
-       {
-               noforkstream = NULL;
-               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.
-        */
-       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.