Index: code/branches/FICN/src/orxonox/core/CMakeLists.txt
===================================================================
--- code/branches/FICN/src/orxonox/core/CMakeLists.txt	(revision 683)
+++ code/branches/FICN/src/orxonox/core/CMakeLists.txt	(revision 684)
@@ -12,8 +12,9 @@
   ArgReader.cc
   DebugLevel.cc
+  OutputHandler.cc
 )
 
 IF(WIN32)
-  ADD_LIBRARY(core ${CORE_SRC_FILES})
+  ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
 ELSE(WIN32)
   ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
Index: code/branches/FICN/src/orxonox/core/CorePrereqs.h
===================================================================
--- code/branches/FICN/src/orxonox/core/CorePrereqs.h	(revision 683)
+++ code/branches/FICN/src/orxonox/core/CorePrereqs.h	(revision 684)
@@ -61,5 +61,6 @@
 class SignalHandler;
 
-namespace orxonox {
+namespace orxonox
+{
   class ArgReader;
   class BaseFactory;
@@ -86,4 +87,5 @@
   class ObjectListElement;
   class OrxonoxClass;
+  class OutputHandler;
   template <class T>
   class SubclassIdentifier;
Index: code/branches/FICN/src/orxonox/core/Debug.h
===================================================================
--- code/branches/FICN/src/orxonox/core/Debug.h	(revision 683)
+++ code/branches/FICN/src/orxonox/core/Debug.h	(revision 684)
@@ -37,5 +37,5 @@
 
 #include <stdio.h>
-#include <iostream>
+#include "OutputHandler.h"
 
 #include "CorePrereqs.h"
@@ -68,5 +68,6 @@
 
 #define PRINT_EXEC  printf
-#define COUT_EXEC   std::cout
+//#define COUT_EXEC   std::cout
+#define COUT_EXEC   orxonox::OutputHandler::getOutStream()
 
 #ifndef PRINTF
Index: code/branches/FICN/src/orxonox/core/DebugLevel.cc
===================================================================
--- code/branches/FICN/src/orxonox/core/DebugLevel.cc	(revision 683)
+++ code/branches/FICN/src/orxonox/core/DebugLevel.cc	(revision 684)
@@ -26,4 +26,9 @@
  */
 
+/*!
+    @file DebugLevel.cc
+    @brief Implementation of the DebugLevel class.
+*/
+
 #include "CoreIncludes.h"
 #include "Debug.h"
@@ -32,7 +37,10 @@
 namespace orxonox
 {
-    DebugLevel* DebugLevel::pointer_s = 0;
-    bool DebugLevel::bCreatingDebugLevelObject_s = false;
+    DebugLevel* DebugLevel::pointer_s = 0;                // Set the static member variable pointer_s to zero
+    bool DebugLevel::bCreatingDebugLevelObject_s = false; // Set the static member variable bCreatingDebugLevelObject_s to false
 
+    /**
+        @brief Constructor: Registers the object and sets the debug level.
+    */
     DebugLevel::DebugLevel()
     {
@@ -41,14 +49,18 @@
     }
 
+    /**
+        @returns a pointer to the only existing instance of this class.
+    */
     int DebugLevel::getSoftDebugLevel()
     {
         if (!pointer_s && !bCreatingDebugLevelObject_s)
         {
+            // We need the bCreatingDebugLevelObject_s variable to avoid an infinite recursion:
+            // Creating the object produces debug output and debug output needs the object.
             bCreatingDebugLevelObject_s = true;
             pointer_s = new DebugLevel;
             bCreatingDebugLevelObject_s = false;
         }
-
-        if (bCreatingDebugLevelObject_s)
+        else if (bCreatingDebugLevelObject_s)
             return 4;
 
@@ -57,4 +69,7 @@
 }
 
+/**
+    @returns the soft debug level, stored in the only existing instance of the DebugLevel class, configured in the config-file.
+*/
 int getSoftDebugLevel()
 {
Index: code/branches/FICN/src/orxonox/core/DebugLevel.h
===================================================================
--- code/branches/FICN/src/orxonox/core/DebugLevel.h	(revision 683)
+++ code/branches/FICN/src/orxonox/core/DebugLevel.h	(revision 684)
@@ -26,4 +26,12 @@
  */
 
+/*!
+    @file DebugLevel.h
+    @brief Definition of the DebugLevel class.
+
+    The DebugLevel class is a singleton, only used to configure the amount of debug
+    output (see Debug.h) into the console and the log-file (see OutputHandler.h).
+*/
+
 #ifndef _DebugLevel_H__
 #define _DebugLevel_H__
@@ -35,14 +43,18 @@
 namespace orxonox
 {
+    //! The DebugLevel class is a singleton, only used to configure the amount of debug output.
     class _CoreExport DebugLevel : public OrxonoxClass
     {
         public:
-            DebugLevel();
             static int getSoftDebugLevel();
 
         private:
-            int softDebugLevel_s;
-            static DebugLevel* pointer_s;
-            static bool bCreatingDebugLevelObject_s;
+            DebugLevel();                       // don't create
+            DebugLevel(const DebugLevel& dl) {} // don't copy
+            ~DebugLevel() {}                    // don't delete
+
+            int softDebugLevel_s;                       //!< The output level
+            static DebugLevel* pointer_s;               //!< A pointer to the only existing instance of this class
+            static bool bCreatingDebugLevelObject_s;    //!< True if the only instance is being created (this is needed to avoid recurstion - creating the object produces debug output, debug output needs the object)
     };
 }
Index: code/branches/FICN/src/orxonox/core/Error.h
===================================================================
--- code/branches/FICN/src/orxonox/core/Error.h	(revision 683)
+++ code/branches/FICN/src/orxonox/core/Error.h	(revision 684)
@@ -20,5 +20,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Nicolas Perrenoud
  *   Co-authors:
  *      ...
Index: code/branches/FICN/src/orxonox/core/OutputHandler.cc
===================================================================
--- code/branches/FICN/src/orxonox/core/OutputHandler.cc	(revision 684)
+++ code/branches/FICN/src/orxonox/core/OutputHandler.cc	(revision 684)
@@ -0,0 +1,191 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OutputHandler.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Opens the logfile and writes the first line.
+        @param logfilename The name of the logfile
+    */
+    OutputHandler::OutputHandler(const std::string& logfilename)
+    {
+        this->logfilename_ = logfilename;
+        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
+        this->logfile_ << "Started log" << std::endl;
+        this->logfile_.flush();
+    }
+
+    /**
+        @brief Destructor: Writes the last line to the logfile and closes it.
+    */
+    OutputHandler::~OutputHandler()
+    {
+        this->logfile_ << "Closed log" << std::endl;
+        this->logfile_.close();
+    }
+
+    /**
+        @returns a reference to the only existing instance of the OutputHandler class.
+    */
+    OutputHandler& OutputHandler::getOutStream()
+    {
+        static OutputHandler orxout("orxonox.log");
+        return orxout;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param sb The streambuffer that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::streambuf* sb)
+    {
+        std::cout << sb;
+        this->logfile_ << sb;
+        this->logfile_.flush();
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    {
+        manipulator(std::cout);
+        manipulator(this->logfile_);
+        this->logfile_.flush();
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ios& (*manipulator)(std::ios&))
+    {
+        manipulator(std::cout);
+        manipulator(this->logfile_);
+        this->logfile_.flush();
+        return *this;
+    }
+
+    /**
+        @brief Overloaded << operator, redirects the output to the console and the logfile.
+        @param manipulator A function, manipulating the outstream.
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& OutputHandler::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    {
+        manipulator(std::cout);
+        manipulator(this->logfile_);
+        this->logfile_.flush();
+        return *this;
+    }
+
+    /**
+        @brief Overloaded non-member << operator, redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& operator<<(OutputHandler& out, char c)
+    {
+        std::cout << c;
+        out.getLogfile() << c;
+        out.getLogfile().flush();
+        return out;
+    }
+
+    /**
+        @brief Overloaded non-member << operator, redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& operator<<(OutputHandler& out, signed char c)
+    {
+        std::cout << c;
+        out.getLogfile() << c;
+        out.getLogfile().flush();
+        return out;
+    }
+
+    /**
+        @brief Overloaded non-member << operator, redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& operator<<(OutputHandler& out, unsigned char c)
+    {
+        std::cout << c;
+        out.getLogfile() << c;
+        out.getLogfile().flush();
+        return out;
+    }
+
+    /**
+        @brief Overloaded non-member << operator, redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& operator<<(OutputHandler& out, const char* s)
+    {
+        std::cout << s;
+        out.getLogfile() << s;
+        out.getLogfile().flush();
+        return out;
+    }
+
+    /**
+        @brief Overloaded non-member << operator, redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& operator<<(OutputHandler& out, const signed char* s)
+    {
+        std::cout << s;
+        out.getLogfile() << s;
+        out.getLogfile().flush();
+        return out;
+    }
+
+    /**
+        @brief Overloaded non-member << operator, redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    OutputHandler& operator<<(OutputHandler& out, const unsigned char* s)
+    {
+        std::cout << s;
+        out.getLogfile() << s;
+        out.getLogfile().flush();
+        return out;
+    }
+ }
Index: code/branches/FICN/src/orxonox/core/OutputHandler.h
===================================================================
--- code/branches/FICN/src/orxonox/core/OutputHandler.h	(revision 684)
+++ code/branches/FICN/src/orxonox/core/OutputHandler.h	(revision 684)
@@ -0,0 +1,136 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/*!
+    @file OutputHandler.h
+    @brief Definition of the OutputHandler class.
+
+    The OutputHandler acts like std::cout, but output isn't only shown in the console,
+    but also written to the logfile.
+*/
+
+#ifndef _OutputHandler_H__
+#define _OutputHandler_H__
+
+#include "CorePrereqs.h"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+namespace orxonox
+{
+    //! The OutputHandler acts like std::cout, but redirects output to the console AND the logfile.
+    class _CoreExport OutputHandler
+    {
+        public:
+            static OutputHandler& getOutStream();
+
+            /** @returns a reference to the logfile. */
+            inline std::ofstream& getLogfile() { return this->logfile_; }
+
+            template <class T>
+            OutputHandler& output(const T& output);
+
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned char val)   { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(short val)           { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned short val)  { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(int val)             { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned int val)    { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(long val)            { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(unsigned long val)   { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(float val)           { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(double val)          { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(long double val)     { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(const void* val)     { return this->output(val); }
+            /** @brief Overloaded << operator, redirects the output to the console and the logfile. @param val The value that should be shown in the console @return A reference to the OutputHandler itself */
+            inline OutputHandler& operator<<(bool val)            { return this->output(val); }
+
+            OutputHandler& operator<<(std::streambuf* sb);
+
+            OutputHandler& operator<<(std::ostream& (*manipulator)(std::ostream&));
+            OutputHandler& operator<<(std::ios& (*manipulator)(std::ios&));
+            OutputHandler& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+
+        private:
+            explicit OutputHandler(const std::string& logfilename);
+            OutputHandler(const OutputHandler& oh) {}; // don't copy
+            ~OutputHandler();
+            std::ofstream logfile_;     //!< The logfile where the output is logged
+            std::string logfilename_;   //!< The name of the logfile
+    };
+
+    /**
+        @brief Redirects the output to the console and the logfile.
+        @param output The value that should be shown in the console
+        @return A reference to the OutputHandler itself
+    */
+    template<class T>
+    OutputHandler& OutputHandler::output(const T& output)
+    {
+        std::cout << output;
+        this->logfile_ << output;
+        this->logfile_.flush();
+        return *this;
+    }
+
+    OutputHandler& operator<<(OutputHandler& out, char c);
+    OutputHandler& operator<<(OutputHandler& out, signed char c);
+    OutputHandler& operator<<(OutputHandler& out, unsigned char c);
+
+    OutputHandler& operator<<(OutputHandler& out, const char* s);
+    OutputHandler& operator<<(OutputHandler& out, const signed char* s);
+    OutputHandler& operator<<(OutputHandler& out, const unsigned char* s);
+
+    /**
+        @brief Overloading of the non-member << operator to redirect the output of classes with self defined '<< to std::ostream' operators to the console and the logfile.
+        @param out The OutputHandler itself
+        @param output The class that should be shown in the console
+        @return The OutputHandler itself
+    */
+    template<class T>
+    OutputHandler& operator<<(OutputHandler& out, const T& output)
+    {
+        std::cout << output;
+        out.getLogfile() << output;
+        out.getLogfile().flush();
+        return out;
+    }
+}
+
+#endif /* _OutputHandler_H__ */
Index: code/branches/FICN/src/orxonox/core/SignalHandler.h
===================================================================
--- code/branches/FICN/src/orxonox/core/SignalHandler.h	(revision 683)
+++ code/branches/FICN/src/orxonox/core/SignalHandler.h	(revision 684)
@@ -86,5 +86,5 @@
 };
 
-#else /* if defined __WIN32__ */
+#else /* #ifndef __WIN32__ */
 
 class _CoreExport SignalHandler
@@ -99,5 +99,5 @@
     static SignalHandler * singletonRef;
 };
-#endif
+#endif /* #ifndef __WIN32__ */
 
 #endif /* _SignalHandler_H__ */
