Index: code/branches/core3/src/util/CMakeLists.txt
===================================================================
--- code/branches/core3/src/util/CMakeLists.txt	(revision 1573)
+++ code/branches/core3/src/util/CMakeLists.txt	(revision 1586)
@@ -7,4 +7,6 @@
   MultiTypeString.cc
   MultiTypeMath.cc
+  OutputBuffer.cc
+  OutputHandler.cc
   String.cc
   SubString.cc
Index: code/branches/core3/src/util/Convert.h
===================================================================
--- code/branches/core3/src/util/Convert.h	(revision 1573)
+++ code/branches/core3/src/util/Convert.h	(revision 1586)
@@ -41,4 +41,5 @@
 
 #include "Math.h"
+#include "Debug.h"
 #include "SubString.h"
 #include "MultiTypeMath.h"
@@ -74,5 +75,8 @@
     enum { specialized = false };
     static bool convert(ToType* output, const FromType& input)
-    { return false; }
+    {
+        COUT(2) << "Warning: Couldn't convert a value." << std::endl;
+        return false;
+    }
 };
 
@@ -139,4 +143,5 @@
     static bool convert(ToType* output, const FromType& input)
     {
+        COUT(2) << "Warning: Couldn't convert a value." << std::endl;
         return false;
     }
Index: code/branches/core3/src/util/Debug.h
===================================================================
--- code/branches/core3/src/util/Debug.h	(revision 1586)
+++ code/branches/core3/src/util/Debug.h	(revision 1586)
@@ -0,0 +1,248 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      Benjamin Grauer
+ *   Co-authors:
+ *      Fabian 'x3n' Landau
+ *
+ */
+
+/**
+ * @file Debug.h
+ * @brief Handles the output for different verbose-modes.
+ *
+ * There are two modes: HARD and SOFT. HARD is precessed during compiletime, while SOFT is for runtime.
+ */
+
+#ifndef _Debug_H__
+#define _Debug_H__
+
+#include "UtilPrereqs.h"
+
+#include <stdio.h>
+
+#include "OutputHandler.h"
+
+
+/**
+    @brief Returns the soft debug level, stored in the only existing instance of the OutputHandler class, configured in the config-file.
+    @return The soft debug level
+*/
+static inline int getSoftDebugLevel()
+{
+    return orxonox::OutputHandler::getSoftDebugLevel();
+}
+
+
+// DEFINE ERROR MODES
+#define ORX_NONE            0
+#define ORX_ERROR           1
+#define ORX_WARNING         2
+#define ORX_INFO            3
+#define ORX_DEBUG           4
+#define ORX_VERBOSE         5
+#define ORX_ULTRA           6
+
+//definitions
+#define ORX_PRINT_DEBUG_OUTPUT 1
+#define ORX_HARD_DEBUG_LEVEL ORX_VERBOSE
+
+#define COUT_EXEC(x) orxonox::OutputHandler::getOutStream().setOutputLevel(x)
+
+////////////////////////////////////////////////////////
+///  COUT: just prints output as is with std::cout   ///
+////////////////////////////////////////////////////////
+#define COUTORX_NONE    COUT0
+#define COUTORX_ERROR   COUT1
+#define COUTORX_WARNING COUT2
+#define COUTORX_INFO    COUT3
+#define COUTORX_DEBUG   COUT4
+#define COUTORX_VERBOSE COUT5
+#define COUTORX_ULTRA   COUT6
+
+#ifndef COUT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define COUT(x) \
+   COUT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
+   #define COUT0  \
+    if (getSoftDebugLevel() >= ORX_NONE)  \
+     COUT_EXEC(0)
+  #else
+   #define COUT0 \
+    false ? COUT_EXEC(0) : COUT_EXEC(0)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define COUT1  \
+    if (getSoftDebugLevel() >= ORX_ERROR)  \
+     COUT_EXEC(1)
+  #else
+   #define COUT1 \
+    false ? COUT_EXEC(1) : COUT_EXEC(1)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define COUT2 \
+    if (getSoftDebugLevel() >= ORX_WARNING) \
+     COUT_EXEC(2)
+  #else
+   #define COUT2 \
+    false ? COUT_EXEC(2) : COUT_EXEC(2)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define COUT3 \
+    if (getSoftDebugLevel() >= ORX_INFO) \
+     COUT_EXEC(3)
+  #else
+   #define COUT3 \
+    false ? COUT_EXEC(3) : COUT_EXEC(3)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define COUT4 \
+    if (getSoftDebugLevel() >= ORX_DEBUG) \
+     COUT_EXEC(4)
+  #else
+   #define COUT4 \
+    false ? COUT_EXEC(4) : COUT_EXEC(4)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
+   #define COUT5 \
+    if (getSoftDebugLevel() >= ORX_VERBOSE) \
+     COUT_EXEC(5)
+  #else
+   #define COUT5 \
+    false ? COUT_EXEC(5) : COUT_EXEC(5)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
+   #define COUT6 \
+    if (getSoftDebugLevel() >= ORX_ULTRA) \
+     COUT_EXEC(6)
+  #else
+   #define COUT6 \
+    false ? COUT_EXEC(6) : COUT_EXEC(6)
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define COUT(x) \
+    false ? COUT_EXEC(6) : COUT_EXEC(6)
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+#endif /* ifndef COUT */
+
+
+/////////////////////////////////////////////////////////////////////
+///  CCOUT: Prints output with std::cout and adds the classname   ///
+/////////////////////////////////////////////////////////////////////
+#define CCOUTORX_NONE    CCOUT0
+#define CCOUTORX_ERROR   CCOUT1
+#define CCOUTORX_WARNING CCOUT2
+#define CCOUTORX_INFO    CCOUT3
+#define CCOUTORX_DEBUG   CCOUT4
+#define CCOUTORX_VERBOSE CCOUT5
+#define CCOUTORX_ULTRA   CCOUT6
+
+#define CCOUT_EXEC(x) \
+  orxonox::OutputHandler::getOutStream().setOutputLevel(x) \
+  << this->getIdentifier()->getName() << ": "
+
+#ifndef CCOUT
+ #if ORX_PRINT_DEBUG_OUTPUT
+  #define CCOUT(x) \
+   CCOUT ## x
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_NONE
+   #define CCOUT0  \
+    if (getSoftDebugLevel() >= ORX_NONE)  \
+     CCOUT_EXEC(0)
+  #else
+   #define CCOUT0 \
+    false ? CCOUT_EXEC(0) : CCOUT_EXEC(0)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ERROR
+   #define CCOUT1  \
+    if (getSoftDebugLevel() >= ORX_ERROR)  \
+     CCOUT_EXEC(1)
+  #else
+   #define CCOUT1 \
+    false ? CCOUT_EXEC(1) : CCOUT_EXEC(1)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_WARNING
+   #define CCOUT2 \
+    if (getSoftDebugLevel() >= ORX_WARNING) \
+     CCOUT_EXEC(2)
+  #else
+   #define CCOUT2 \
+    false ? CCOUT_EXEC(2) : CCOUT_EXEC(2)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_INFO
+   #define CCOUT3 \
+    if (getSoftDebugLevel() >= ORX_INFO) \
+     CCOUT_EXEC(3)
+  #else
+   #define CCOUT3 \
+    false ? CCOUT_EXEC(3) : CCOUT_EXEC(3)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_DEBUG
+   #define CCOUT4 \
+    if (getSoftDebugLevel() >= ORX_DEBUG) \
+     CCOUT_EXEC(4)
+  #else
+   #define CCOUT4 \
+    false ? CCOUT_EXEC(4) : CCOUT_EXEC(4)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_VERBOSE
+   #define CCOUT5 \
+    if (getSoftDebugLevel() >= ORX_VERBOSE) \
+     CCOUT_EXEC(5)
+  #else
+   #define CCOUT5 \
+    false ? CCOUT_EXEC(5) : CCOUT_EXEC(5)
+  #endif
+
+  #if ORX_HARD_DEBUG_LEVEL >= ORX_ULTRA
+   #define CCOUT6 \
+    if (getSoftDebugLevel() >= ORX_ULTRA) \
+     CCOUT_EXEC(6)
+  #else
+   #define CCOUT6 \
+    false ? CCOUT_EXEC(6) : CCOUT_EXEC(6)
+  #endif
+
+ #else /* if ORX_PRINT_DEBUG_OUTPUT */
+  #define CCOUT(x) \
+   false ? CCOUT_EXEC(6) : CCOUT_EXEC(6)
+ #endif /* if ORX_PRINT_DEBUG_OUTPUT */
+
+#endif /* ifndef CCOUT */
+
+#endif /* _Debug_H__ */
Index: code/branches/core3/src/util/OutputBuffer.cc
===================================================================
--- code/branches/core3/src/util/OutputBuffer.cc	(revision 1586)
+++ code/branches/core3/src/util/OutputBuffer.cc	(revision 1586)
@@ -0,0 +1,96 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 "OutputBuffer.h"
+
+#define OUTPUTBUFFER_MAX_LINE_LENGTH 16384
+
+namespace orxonox
+{
+    void OutputBuffer::registerListener(OutputBufferListener* listener)
+    {
+        this->listeners_.insert(this->listeners_.end(), listener);
+    }
+
+    void OutputBuffer::unregisterListener(OutputBufferListener* listener)
+    {
+        for (std::list<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); )
+        {
+            if ((*it) == listener)
+                this->listeners_.erase(it++);
+            else
+                ++it;
+        }
+    }
+
+    OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    {
+                this->stream_ << manipulator;
+                this->callListeners();
+                return *this;
+    }
+
+    OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&))
+    {
+                this->stream_ << manipulator;
+                this->callListeners();
+                return *this;
+    }
+
+    OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    {
+                this->stream_ << manipulator;
+                this->callListeners();
+                return *this;
+    }
+
+    bool OutputBuffer::getLine(std::string* output)
+    {
+        char line[OUTPUTBUFFER_MAX_LINE_LENGTH];
+
+        this->stream_.getline(line, OUTPUTBUFFER_MAX_LINE_LENGTH);
+        (*output) = std::string(line);
+
+        bool eof = this->stream_.eof();
+        bool fail = this->stream_.fail();
+
+        if (eof)
+            this->stream_.flush();
+
+        if (eof || fail)
+            this->stream_.clear();
+
+        return (!eof && !fail);
+    }
+
+    void OutputBuffer::callListeners()
+    {
+        for (std::list<OutputBufferListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+            (*it)->outputChanged();
+    }
+}
Index: code/branches/core3/src/util/OutputBuffer.h
===================================================================
--- code/branches/core3/src/util/OutputBuffer.h	(revision 1586)
+++ code/branches/core3/src/util/OutputBuffer.h	(revision 1586)
@@ -0,0 +1,118 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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:
+ *      ...
+ *
+ */
+
+#ifndef _OutputBuffer_H__
+#define _OutputBuffer_H__
+
+#include <list>
+#include <sstream>
+#include <iostream>
+
+#include "UtilPrereqs.h"
+
+namespace orxonox
+{
+    class _UtilExport OutputBufferListener
+    {
+        friend class OutputBuffer;
+
+        public:
+            virtual ~OutputBufferListener() {}
+
+        private:
+            virtual void outputChanged() = 0;
+    };
+
+    class _UtilExport OutputBuffer
+    {
+        public:
+            OutputBuffer() {}
+            ~OutputBuffer() {}
+
+            template <class T>
+            inline OutputBuffer& operator<<(T object)
+            {
+                this->stream_ << object;
+                this->callListeners();
+                return *this;
+            }
+
+            template <const OutputBuffer&>
+            inline OutputBuffer& operator<<(const OutputBuffer& object)
+            {
+                this->stream_ << object.stream_;
+                this->callListeners();
+                return *this;
+            }
+
+            OutputBuffer& operator<<(std::ostream& (*manipulator)(std::ostream&));
+            OutputBuffer& operator<<(std::ios& (*manipulator)(std::ios&));
+            OutputBuffer& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
+
+            template <class T>
+            inline void add(T object)
+            {
+                this->stream_ << object;
+                this->callListeners();
+            }
+
+            template <class T>
+            inline void addLine(T object)
+            {
+                this->stream_ << object << std::endl;
+                this->callListeners();
+            }
+
+            inline void newline()
+            {
+                this->stream_ << std::endl;
+                this->callListeners();
+            }
+
+            inline void flush()
+            {
+                this->stream_.flush();
+            }
+
+            bool getLine(std::string* output);
+
+            void registerListener(OutputBufferListener* listener);
+            void unregisterListener(OutputBufferListener* listener);
+
+            inline std::stringstream& getStream()
+                { return this->stream_; }
+
+        private:
+            void callListeners();
+
+            std::stringstream stream_;
+            std::list<OutputBufferListener*> listeners_;
+    };
+}
+
+#endif /* _OutputBuffer_H__ */
Index: code/branches/core3/src/util/OutputHandler.cc
===================================================================
--- code/branches/core3/src/util/OutputHandler.cc	(revision 1586)
+++ code/branches/core3/src/util/OutputHandler.cc	(revision 1586)
@@ -0,0 +1,188 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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.cc
+    @brief Implementation of the OutputHandler class.
+*/
+
+#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->outputBuffer_ = &this->fallbackBuffer_;
+        this->softDebugLevel_[0] = this->softDebugLevel_[1] = this->softDebugLevel_[2] = this->softDebugLevel_[3] = 2;
+        this->logfilename_ = logfilename;
+        this->logfile_.open(this->logfilename_.c_str(), std::fstream::out);
+        this->logfile_ << "Started log at yyyy/mm/dd hh:mm:ss" << 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();
+    }
+
+    /**
+        @brief Returns a reference to the only existing instance of the OutputHandler class.
+        @return The instance
+    */
+    OutputHandler& OutputHandler::getOutStream()
+    {
+        static OutputHandler orxout("orxonox.log");
+        return orxout;
+    }
+
+    /**
+        @brief Sets the soft debug level for a given output device.
+        @param device The output device
+        @param level The debug level
+    */
+    void OutputHandler::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
+    {
+        OutputHandler::getOutStream().softDebugLevel_[(unsigned int)device] = level;
+    }
+
+    /**
+        @brief Returns the soft debug level for a given output device.
+        @param device The output device
+        @return The debug level
+    */
+    int OutputHandler::getSoftDebugLevel(OutputHandler::OutputDevice device)
+    {
+        return OutputHandler::getOutStream().softDebugLevel_[(unsigned int)device];
+    }
+
+    /**
+        @brief Sets the OutputBuffer, representing the third output stream.
+        @param buffer The OutputBuffer
+    */
+    void OutputHandler::setOutputBuffer(OutputBuffer& buffer)
+    {
+        buffer.getStream() >> this->outputBuffer_->getStream().rdbuf();
+        this->outputBuffer_ = &buffer;
+    }
+
+    /**
+        @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)
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            std::cout << sb;
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            this->logfile_ << sb;
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << sb;
+
+        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&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        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&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        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&))
+    {
+        if (getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            manipulator(std::cout);
+
+        if (getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            manipulator(this->logfile_);
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << manipulator;
+
+        return *this;
+    }
+}
Index: code/branches/core3/src/util/OutputHandler.h
===================================================================
--- code/branches/core3/src/util/OutputHandler.h	(revision 1586)
+++ code/branches/core3/src/util/OutputHandler.h	(revision 1586)
@@ -0,0 +1,200 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   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 "UtilPrereqs.h"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "OutputBuffer.h"
+
+namespace orxonox
+{
+    //! The OutputHandler acts like std::cout, but redirects output to the console AND the logfile.
+    class _UtilExport OutputHandler
+    {
+        public:
+            enum OutputDevice
+            {
+                LD_All = 0,
+                LD_Console = 1,
+                LD_Logfile = 2,
+                LD_Shell = 3
+            };
+
+            static OutputHandler& getOutStream();
+
+            /** @brief Puts some text on the outstream. @param text The text */
+            static inline std::string log(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(0); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts an error on the outstream. @param text The text */
+            static inline std::string error(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(1); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts a warning on the outstream. @param text The text */
+            static inline std::string warning(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(2); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts an info on the outstream. @param text The text */
+            static inline std::string info(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(3); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Puts some debug output on the outstream. @param text The text */
+            static inline std::string debug(const std::string& text)
+                { OutputHandler::getOutStream().setOutputLevel(4); OutputHandler::getOutStream().output(text + "\n"); return text; }
+
+            /** @brief Returns a reference to the logfile. @return The logfile */
+            inline std::ofstream& getLogfile()
+                { return this->logfile_; }
+
+            /** @brief Returns a pointer to the OutputBuffer. @return The OutputBuffer */
+            inline OutputBuffer* getOutputBuffer()
+                { return this->outputBuffer_; }
+
+            /** @brief Sets the level of the incoming output. @param level The level of the incoming output @return The OutputHandler itself */
+            inline OutputHandler& setOutputLevel(int level)
+                { this->outputLevel_ = level; return *this; }
+
+            /** @brief Returns the level of the incoming output. @return The level */
+            inline int getOutputLevel() const
+                { return this->outputLevel_; }
+
+            static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
+            static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
+
+            void setOutputBuffer(OutputBuffer& buffer);
+
+            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
+            virtual ~OutputHandler();
+
+            std::ofstream logfile_;              //!< The logfile where the output is logged
+            std::string logfilename_;            //!< The name of the logfile
+            OutputBuffer fallbackBuffer_;        //!< The OutputBuffer that gets used if there is no other OutputBuffer
+            OutputBuffer* outputBuffer_;         //!< The OutputBuffer to put output in (usually used by the Shell)
+            int outputLevel_;                    //!< The level of the incoming output
+            int softDebugLevel_[4];              //!< The soft debug level for each OutputDevice - the configurable maximal output level
+    };
+
+    /**
+        @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)
+    {
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= this->outputLevel_)
+            std::cout << output;
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= this->outputLevel_)
+        {
+            this->logfile_ << output;
+            this->logfile_.flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
+            (*this->outputBuffer_) << output;
+
+        return *this;
+    }
+
+    /**
+        @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)
+    {
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Console) >= out.getOutputLevel())
+            std::cout << output;
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Logfile) >= out.getOutputLevel())
+        {
+            out.getLogfile() << output;
+            out.getLogfile().flush();
+        }
+
+        if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= out.getOutputLevel())
+            (*out.getOutputBuffer()) << output;
+
+        return out;
+    }
+}
+
+#endif /* _OutputHandler_H__ */
Index: code/branches/core3/src/util/String.h
===================================================================
--- code/branches/core3/src/util/String.h	(revision 1573)
+++ code/branches/core3/src/util/String.h	(revision 1586)
@@ -129,5 +129,5 @@
             std::string input = "3.14";
             float f;
-            bool success = string2Number(&f, input);
+            bool success = FromString(&f, input);
         */
         template <typename T>
@@ -151,5 +151,5 @@
             std::string input = "3.14";
             float f;
-            bool success = string2Number(&f, input, 0.000000);
+            bool success = FromString(&f, input, 0.000000);
         */
         template <typename T>
Index: code/branches/core3/src/util/UtilPrereqs.h
===================================================================
--- code/branches/core3/src/util/UtilPrereqs.h	(revision 1573)
+++ code/branches/core3/src/util/UtilPrereqs.h	(revision 1586)
@@ -65,7 +65,12 @@
 class MultiTypeString;
 class MultiTypeMath;
-template <class T>
-class String2Number;
+class OutputHandler;
 class SubString;
 
+namespace orxonox
+{
+    class OutputBuffer;
+    class OutputBufferListener;
+}
+
 #endif /* _UtilPrereqs_H__ */
