Index: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt	(revision 8857)
+++ code/trunk/CMakeLists.txt	(revision 8858)
@@ -29,4 +29,14 @@
 ENDIF()
 
+# Keep devs from using the root directory as binary directory (messes up the source tree)
+IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
+  MESSAGE(FATAL_ERROR "Please do not use the root directory as CMake output directory!
+  mkdir build; cd build; cmake ..
+  And you will have to clean the source directory by deleting CMakeCache.txt and the folder CMakeFiles")
+ENDIF()
+
+PROJECT(Orxonox C CXX)
+
+# Check AFTER the PROJECT command because MSVC10 gets defined there
 IF(WIN32)
   IF(MSVC10)
@@ -38,13 +48,4 @@
   CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
 ENDIF()
-
-# Keep devs from using the root directory as binary directory (messes up the source tree)
-IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
-  MESSAGE(FATAL_ERROR "Please do not use the root directory as CMake output directory!
-  mkdir build; cd build; cmake ..
-  And you will have to clean the source directory by deleting CMakeCache.txt and the folder CMakeFiles")
-ENDIF()
-
-PROJECT(Orxonox C CXX)
 
 ################ General Config #################
Index: code/trunk/data/gui/scripts/GameplayMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/GameplayMenu.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/GameplayMenu.lua	(revision 8858)
@@ -18,20 +18,20 @@
 function P.GameplayThemeCombobox_changed(e)
     -- theme
-    logMessage(0, "event: theme")
+    orxout("event: theme")
 end
 
 function P.GameplayDifficultyEasyButton_clicked(e)
     -- difficulty easy
-    logMessage(0, "event: easy")
+    orxout("event: easy")
 end
 
 function P.GameplayDifficultyNormalButton_clicked(e)
     -- difficulty normal
-    logMessage(0, "event: normal")
+    orxout("event: normal")
 end
 
 function P.GameplayDifficultyHardButton_clicked(e)
     -- difficulty hard
-    logMessage(0, "event: hard")
+    orxout("event: hard")
 end
 
Index: code/trunk/data/gui/scripts/MultiplayerMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MultiplayerMenu.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/MultiplayerMenu.lua	(revision 8858)
@@ -117,8 +117,8 @@
         local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
         CEGUI.toListbox(listbox):resetList()
-        local discovery = orxonox.WANDiscovery:getInstance()
-        cout(0, "discovering.\n" )
+        local discovery = orxonox.WANDiscovery()
+        orxout("discovering." )
         discovery:discover()
-        cout(0, "discovered.\n" )
+        orxout("discovered." )
         P.serverList = {}
         local index = 0
Index: code/trunk/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/trunk/data/gui/scripts/NotificationLayer.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/NotificationLayer.lua	(revision 8858)
@@ -136,5 +136,5 @@
     if index > queue.first then -- Move all older notifications up in the list.
         for i=index-1,-1,queue.first do
-            cout(0, i)
+            orxout(i)
             item = queue.items[i]
             item:setYposition(CEGUI.UDim(0, itemHeight*(queue.last-i-1)))
Index: code/trunk/data/gui/scripts/QuestGUI.lua
===================================================================
--- code/trunk/data/gui/scripts/QuestGUI.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/QuestGUI.lua	(revision 8858)
@@ -220,5 +220,5 @@
 function P.selectQuest(list, quest)
     if quest == nil then -- If the input quest is nil, there is nothing to be selected, an error is output and the first quest is selected instead.
-        cout(1, "Error in QuestGUI: selectQuest(), input quest is nil. Selecting first.")
+        orxout(orxonox.level.internal_error, "Error in QuestGUI: selectQuest(), input quest is nil. Selecting first.")
         list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
         return
@@ -240,5 +240,5 @@
         list:setItemSelectState(list:getListboxItemFromIndex(index), true)
     else -- If the quest isn't found an error is output and the first quest is selected instead.
-        cout(1, "Error in QuestGUI: selectQuest(), input quest is not in list. Selecting first.")
+        orxout(orxonox.level.internal_error, "Error in QuestGUI: selectQuest(), input quest is not in list. Selecting first.")
         list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
     end
@@ -313,5 +313,5 @@
             end
         else
-            cout(1, "Error in QuestGUI: changeToSubquest(), quest was nil. Ignoring...")
+            orxout(orxonox.level.internal_error, "Error in QuestGUI: changeToSubquest(), quest was nil. Ignoring...")
         end
     end
Index: code/trunk/data/levels/presentationDM.oxw
===================================================================
--- code/trunk/data/levels/presentationDM.oxw	(revision 8857)
+++ code/trunk/data/levels/presentationDM.oxw	(revision 8858)
@@ -16,4 +16,5 @@
  name         = "Presentation"
  description  = "A simple testlevel"
+ gametype     = Deathmatch
 >
   <templates>
@@ -46,11 +47,12 @@
       for i = 1, 100, 1 do
         j = math.random()
+        scale = j * 50 + 5
     ?>
-      <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass="<?lua print(j * 50) ?>" scale="<?lua print(j * 5) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+      <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass="<?lua print(scale) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
         <attached>
-          <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+          <Model scale="<?lua print(scale) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
         </attached>
         <collisionShapes>
-          <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
+          <SphereCollisionShape radius="<?lua print(scale * 2.5) ?>" />
         </collisionShapes>
       </MovableEntity>
Index: code/trunk/data/levels/templates/FPS.oxt
===================================================================
--- code/trunk/data/levels/templates/FPS.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/FPS.oxt	(revision 8858)
@@ -30,5 +30,5 @@
     
     <?lua
-	include("includes/weaponSettingsFPS.oxi")
+	include("../includes/weaponSettingsFPS.oxi")
     ?>
 
Index: code/trunk/data/levels/templates/spaceshipAssff.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipAssff.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipAssff.oxt	(revision 8858)
@@ -56,5 +56,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsAssff.oxi")
+  include("../includes/weaponSettingsAssff.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipAssff2.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipAssff2.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipAssff2.oxt	(revision 8858)
@@ -56,5 +56,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsAssff2.oxi")
+  include("../includes/weaponSettingsAssff2.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipGhost.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipGhost.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipGhost.oxt	(revision 8858)
@@ -53,5 +53,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsGhost.oxi")
+  include("../includes/weaponSettingsGhost.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipH2.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipH2.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipH2.oxt	(revision 8858)
@@ -22,5 +22,5 @@
 
 <?lua
-  include("includes/weaponSettingsH2.oxi")
+  include("../includes/weaponSettingsH2.oxi")
 ?>
     <engines>
Index: code/trunk/data/levels/templates/spaceshipHXY.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipHXY.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipHXY.oxt	(revision 8858)
@@ -37,5 +37,5 @@
 
 <?lua
-  include("includes/weaponSettingsHXY.oxi")
+  include("../includes/weaponSettingsHXY.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipHXYSL.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipHXYSL.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipHXYSL.oxt	(revision 8858)
@@ -36,5 +36,5 @@
 
 <?lua
-  include("includes/weaponSettingsHXY.oxi")
+  include("../includes/weaponSettingsHXY.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipPirate.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipPirate.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipPirate.oxt	(revision 8858)
@@ -55,5 +55,5 @@
 
 <?lua
-  include("includes/weaponSettingsPirate.oxi")
+  include("../includes/weaponSettingsPirate.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipSwallow.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipSwallow.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipSwallow.oxt	(revision 8858)
@@ -50,5 +50,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsSwallow.oxi")
+  include("../includes/weaponSettingsSwallow.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipTransporter.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipTransporter.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipTransporter.oxt	(revision 8858)
@@ -36,5 +36,5 @@
 
 <?lua
-  include("includes/weaponSettingsTransporter.oxi")
+  include("../includes/weaponSettingsTransporter.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipTransporterSL.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipTransporterSL.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipTransporterSL.oxt	(revision 8858)
@@ -36,5 +36,5 @@
 
 <?lua
-  include("includes/weaponSettingsTransporter.oxi")
+  include("../includes/weaponSettingsTransporter.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/lua/LuaStateInit.lua
===================================================================
--- code/trunk/data/lua/LuaStateInit.lua	(revision 8857)
+++ code/trunk/data/lua/LuaStateInit.lua	(revision 8858)
@@ -7,9 +7,19 @@
 end
 
--- Create function to log text like COUT, but always prints a line!
-logMessage = function(level, message)
-  luaState:luaLog(level, message)
+-- Prints output to the console and the logfile
+--
+-- Accepts the following arguments:
+--   orxout("message")
+--   orxout(orxonox.level.levelname, "message")
+--   orxout(orxonox.level.levelname, "context", "message)
+orxout = function(arg1, arg2, arg3)
+  if arg1 and arg2 and arg3 then
+    luaState:luaOutput(arg1, arg2, arg3)
+  elseif arg1 and arg2 then
+    luaState:luaOutput(arg1, arg2)
+  else
+    luaState:luaOutput(arg1)
+  end
 end
-cout = logMessage
 
 -- Redirect dofile in order to load with the resource manager
@@ -42,5 +52,5 @@
 require = function(moduleName)
   if not luaState:fileExists(moduleName .. ".lua") then
-    logMessage(2, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ")
+    orxout(orxonox.level.internal_warning, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ")
     return nil
   end
@@ -85,5 +95,5 @@
   -- Fallback pause function
   pause = function()
-    logMessage(2, [["Warning: debug() called in Lua, but Debugger is not active.
+    orxout(orxonox.level.internal_warning, [["Warning: debug() called in Lua, but Debugger is not active.
 Do you have the IOConsole disabled and are you using Lua version 5.1?"]])
   end
@@ -98,5 +108,5 @@
     end
     -- Display the error message
-    logMessage(1, "Lua runtime error: "..err)
+    orxout(orxonox.level.internal_error, "Lua runtime error: "..err)
   end
 
@@ -106,5 +116,5 @@
   else
     -- Fallback: print stack trace
-    logMessage(3, debug.traceback(""))
+    orxout(orxonox.level.internal_error, debug.traceback(""))
   end
   return err -- Hello Lua debugger user! Please type 'set 2' to get to the
Index: code/trunk/data/overlays/OrxonoxLoading.overlay
===================================================================
--- code/trunk/data/overlays/OrxonoxLoading.overlay	(revision 8857)
+++ 	(revision )
@@ -1,13 +1,0 @@
-Orxonox/LoadingScreenSample
-{
-   container Panel(Orxonox/LoadingScreenSample)
-   {
-      metrics_mode pixels
-      vert_align top
-      left 12
-      top 12
-      width 300
-      height 300
-      material Orxonox/LoadingScreenSample
-   }
-}
Index: code/trunk/data/overlays/debug.oxo
===================================================================
--- code/trunk/data/overlays/debug.oxo	(revision 8857)
+++ code/trunk/data/overlays/debug.oxo	(revision 8858)
@@ -40,12 +40,4 @@
 <Template name="defaultHUD">
   <OverlayGroup name = "defaultHUD" scale = "1, 1">
-    <ChatOverlay
-     name     = "chat"
-     position = "0.03, 0.08"
-     font     = "VeraMono"
-     caption  = ""
-     textsize = 0.025
-    />
-
     <KillMessage
      name     = "killmessage"
@@ -84,4 +76,12 @@
     />
 
+    <ChatOverlay
+     name     = "chat"
+     position = "0.03, 0.08"
+     font     = "VeraMono"
+     caption  = ""
+     textsize = 0.025
+    />
+
   </OverlayGroup>
 </Template>
Index: code/trunk/data/tcl/init.tcl
===================================================================
--- code/trunk/data/tcl/init.tcl	(revision 8857)
+++ code/trunk/data/tcl/init.tcl	(revision 8858)
@@ -169,6 +169,8 @@
     foreach {channel s} $input break
 
-    if {$channel == "stdout" || $channel == "stderr"} {
-        execute puts $newline $s
+    if {$channel == "stdout"} {
+        execute log $s
+    } elseif {$channel == "stderr"} {
+        execute error $s
     } else {
         eval [concat ::tcl::puts $args]
Index: code/trunk/src/Orxonox.cc
===================================================================
--- code/trunk/src/Orxonox.cc	(revision 8857)
+++ code/trunk/src/Orxonox.cc	(revision 8858)
@@ -43,5 +43,5 @@
 #endif
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "orxonox/Main.h"
@@ -59,4 +59,11 @@
 #endif
 {
+    using namespace orxonox;
+
+    orxout(user_status) << "Welcome to Orxonox (v" << ORXONOX_VERSION_MAJOR << '.' << ORXONOX_VERSION_MINOR << '.' << ORXONOX_VERSION_PATCH << ' ' << ORXONOX_VERSION_NAME << ')' << endl;
+    orxout(internal_status) << "Congratulations, you survived the static initialization. Entering main()" << endl;
+    if (argc > 0)
+        orxout(internal_info) << "argv[0]: " << argv[0] << endl;
+
     try
     {
@@ -70,5 +77,5 @@
         const int firstArgument = 1;
 #endif
-    
+
         std::string strCmdLine;
         for (int i = firstArgument; i < argc; ++i)
@@ -76,10 +83,12 @@
 #endif
 
-        return orxonox::main(strCmdLine);
+        int value = main(strCmdLine);
+        orxout(internal_status) << "Terminating main() normally with value " << value << endl;
+        return value;
     }
     catch (...)
     {
-        COUT(0) << "Orxonox failed to initialise: " << orxonox::Exception::handleMessage() << std::endl;
-        COUT(0) << "Terminating program." << std::endl;
+        orxout(user_error) << "Exception caught in main(): " << orxonox::Exception::handleMessage() << endl;
+        orxout(user_error) << "Terminating program." << endl;
         return 1;
     }
Index: code/trunk/src/OrxonoxConfig.h.in
===================================================================
--- code/trunk/src/OrxonoxConfig.h.in	(revision 8857)
+++ code/trunk/src/OrxonoxConfig.h.in	(revision 8858)
@@ -106,4 +106,15 @@
 #  else
 #    define __FUNCTIONNAME__
+#  endif
+#endif
+
+// Declare a function deprecated
+#ifndef __DEPRECATED__
+#  if defined(ORXONOX_COMPILER_GCC)
+#    define __DEPRECATED__(function) function __attribute__ ((deprecated))
+#  elif defined(ORXONOX_COMPILER_MSVC)
+#    define __DEPRECATED__(function) __declspec(deprecated) function
+#  else
+#    define __DEPRECATED__(function) function
 #  endif
 #endif
Index: code/trunk/src/libraries/core/BaseObject.cc
===================================================================
--- code/trunk/src/libraries/core/BaseObject.cc	(revision 8857)
+++ code/trunk/src/libraries/core/BaseObject.cc	(revision 8858)
@@ -109,5 +109,5 @@
     void BaseObject::registerEventListener(BaseObject* object)
     {
-        COUT(4) << "New EventListener: " << object->getIdentifier()->getName() << " &(" << object << ")." << std::endl;
+        orxout(verbose, context::events) << "New EventListener: " << object->getIdentifier()->getName() << " &(" << object << ")." << endl;
         this->eventListeners_.insert(object);
     }
@@ -186,5 +186,5 @@
             this->addTemplate(temp);
         else
-            COUT(1) << "Error: \"" << name << "\" is not a valid Template name (in class: " << this->getIdentifier()->getName() << ", name: " << this->getName() << ")." << std::endl;
+            orxout(internal_error) << "\"" << name << "\" is not a valid Template name (in class: " << this->getIdentifier()->getName() << ", name: " << this->getName() << ")." << endl;
     }
 
@@ -312,5 +312,5 @@
         if (it != this->eventStates_.end())
         {
-            COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << '.' << std::endl;
+            orxout(internal_warning, context::events) << "Overwriting EventState in class " << this->getIdentifier()->getName() << '.' << endl;
             delete (it->second);
         }
@@ -379,5 +379,5 @@
         this->registerEventStates();
 
-        COUT(4) << this->getIdentifier()->getName() << " (&" << this << ") processing event. originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << "), activate: " << event.activate_ << ", name: " << event.name_ << ", statename: " << event.statename_ << "." << std::endl;
+        orxout(verbose, context::events) << this->getIdentifier()->getName() << " (&" << this << ") processing event. originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << "), activate: " << event.activate_ << ", name: " << event.name_ << ", statename: " << event.statename_ << "." << endl;
 
         std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(event.statename_);
@@ -385,7 +385,7 @@
             it->second->process(event, this);
         else if (!event.statename_.empty())
-            COUT(2) << "Warning: \"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl;
-        else
-            COUT(2) << "Warning: Event with invalid source sent to object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl;
+            orxout(internal_warning, context::events) << "\"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << endl;
+        else
+            orxout(internal_warning, context::events) << "Event with invalid source sent to object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << endl;
     }
 
@@ -412,5 +412,5 @@
         }
         else
-            COUT(2) << "Warning: No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << std::endl;
+            orxout(internal_warning, context::events) << "No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << endl;
     }
 
@@ -432,8 +432,8 @@
                     this->mainStateFunctor_ = it->second->getFunctor();
                 else
-                    COUT(2) << "Warning: Can't use \"" << this->mainStateName_ << "\" as MainState because it needs a second argument." << std::endl;
+                    orxout(internal_warning, context::events) << "Can't use \"" << this->mainStateName_ << "\" as MainState because it needs a second argument." << endl;
             }
             else
-                COUT(2) << "Warning: \"" << this->mainStateName_ << "\" is not a valid MainState." << std::endl;
+                orxout(internal_warning, context::events) << "\"" << this->mainStateName_ << "\" is not a valid MainState." << endl;
         }
     }
Index: code/trunk/src/libraries/core/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/core/CMakeLists.txt	(revision 8857)
+++ code/trunk/src/libraries/core/CMakeLists.txt	(revision 8858)
@@ -86,4 +86,5 @@
     input/KeyBinder.h
     input/KeyBinderManager.h
+    ../util/output/OutputDefinitions.h
   PCH_FILE
     CorePrecompiledHeaders.h
Index: code/trunk/src/libraries/core/ClassFactory.h
===================================================================
--- code/trunk/src/libraries/core/ClassFactory.h	(revision 8857)
+++ code/trunk/src/libraries/core/ClassFactory.h	(revision 8858)
@@ -42,5 +42,5 @@
 #include <string>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "Identifier.h"
 
@@ -73,5 +73,5 @@
             ClassFactory(const std::string& name, bool bLoadable = true)
             {
-                COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
+                orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl;
                 ClassIdentifier<T>::getIdentifier(name)->addFactory(this);
                 ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
Index: code/trunk/src/libraries/core/CommandLineParser.cc
===================================================================
--- code/trunk/src/libraries/core/CommandLineParser.cc	(revision 8857)
+++ code/trunk/src/libraries/core/CommandLineParser.cc	(revision 8858)
@@ -33,5 +33,5 @@
 
 #include "util/Convert.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "util/StringUtils.h"
@@ -229,6 +229,6 @@
         catch (const ArgumentException& ex)
         {
-            COUT(0) << "Could not parse command line: " << ex.what() << std::endl;
-            COUT(0) << CommandLineParser::getUsageInformation() << std::endl;
+            orxout(user_error) << "Could not parse command line: " << ex.what() << endl;
+            orxout(user_error) << CommandLineParser::getUsageInformation() << endl;
             throw GeneralException("");
         }
@@ -286,7 +286,7 @@
         }
 
-        infoStr << std::endl;
-        infoStr << "Usage: orxonox [options]" << std::endl;
-        infoStr << "Available options:" << std::endl;
+        infoStr << endl;
+        infoStr << "Usage: orxonox [options]" << endl;
+        infoStr << "Available options:" << endl;
 
         for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
@@ -305,5 +305,5 @@
             infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
             infoStr << ": " << it->second->getInformation();
-            infoStr << std::endl;
+            infoStr << endl;
         }
         return infoStr.str();
Index: code/trunk/src/libraries/core/CommandLineParser.h
===================================================================
--- code/trunk/src/libraries/core/CommandLineParser.h	(revision 8857)
+++ code/trunk/src/libraries/core/CommandLineParser.h	(revision 8858)
@@ -218,5 +218,5 @@
             "Cannot add a command line argument with name '" + name + "' twice.");
         OrxAssert(MultiType(defaultValue).getType() != MT_Type::Bool || MultiType(defaultValue).getBool() != true,
-               "Boolean command line arguments with positive default values are not supported." << std::endl
+               "Boolean command line arguments with positive default values are not supported." << endl
             << "Please use SetCommandLineSwitch and adjust your argument: " << name);
 
Index: code/trunk/src/libraries/core/ConfigFileManager.cc
===================================================================
--- code/trunk/src/libraries/core/ConfigFileManager.cc	(revision 8857)
+++ code/trunk/src/libraries/core/ConfigFileManager.cc	(revision 8858)
@@ -123,10 +123,7 @@
         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
             if ((*it)->getName() == name)
-                if ((*it)->getIndex() > size)
-                    size = (*it)->getIndex();
-        if (size == 0)
-            return 0;
-        else
-            return (size + 1);
+                if ((*it)->getIndex() >= size)
+                    size = (*it)->getIndex() + 1;
+        return size;
     }
 
@@ -274,8 +271,8 @@
                         {
                             boost::filesystem::copy_file(defaultFilepath, filepath);
-                            COUT(3) << "Copied " << this->filename_ << " from the default config folder." << std::endl;
+                            orxout(internal_info, context::config) << "Copied " << this->filename_ << " from the default config folder." << endl;
                         }
                         catch (const boost::filesystem::filesystem_error& ex)
-                        { COUT(1) << "Error in ConfigFile: " << ex.what() << std::endl; }
+                        { orxout(user_error, context::config) << "Error in ConfigFile: " << ex.what() << endl; }
                     }
                 }
@@ -375,5 +372,5 @@
             file.close();
 
-            COUT(3) << "Loaded config file \"" << this->filename_ << "\"." << std::endl;
+            orxout(internal_info, context::config) << "Loaded config file \"" << this->filename_ << "\"." << endl;
 
             // DO NOT save the file --> we can open supposedly read only config files
@@ -404,5 +401,5 @@
         if (!file.is_open())
         {
-            COUT(1) << "Error: Couldn't open config-file \"" << filename << "\"." << std::endl;
+            orxout(user_error, context::config) << "Couldn't open config-file \"" << filename << "\"." << endl;
             return;
         }
@@ -410,15 +407,15 @@
         for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
         {
-            file << (*it)->getFileEntry() << std::endl;
+            file << (*it)->getFileEntry() << endl;
 
             for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
-                file << (*it_entries)->getFileEntry() << std::endl;
-
-            file << std::endl;
+                file << (*it_entries)->getFileEntry() << endl;
+
+            file << endl;
         }
 
         file.close();
 
-        COUT(4) << "Saved config file \"" << filename << "\"." << std::endl;
+        orxout(verbose, context::config) << "Saved config file \"" << filename << "\"." << endl;
     }
 
@@ -669,5 +666,5 @@
     {
         if (!this->configImpl(section, entry, value, &ConfigValueContainer::set))
-            COUT(1) << "Error: Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << std::endl;
+            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
     }
 
@@ -682,5 +679,5 @@
     {
         if (!this->configImpl(section, entry, value, &ConfigValueContainer::tset))
-            COUT(1) << "Error: Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << std::endl;
+            orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
     }
 
Index: code/trunk/src/libraries/core/ConfigValueContainer.cc
===================================================================
--- code/trunk/src/libraries/core/ConfigValueContainer.cc	(revision 8857)
+++ code/trunk/src/libraries/core/ConfigValueContainer.cc	(revision 8858)
@@ -143,5 +143,5 @@
         else
         {
-            COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+            orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
         }
         return false;
@@ -182,5 +182,5 @@
             if (index > MAX_VECTOR_INDEX)
             {
-                COUT(1) << "Error: Index " << index << " is too large." << std::endl;
+                orxout(user_error, context::config) << "Index " << index << " is too large." << endl;
                 return false;
             }
@@ -203,5 +203,5 @@
         else
         {
-            COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+            orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
             return false;
         }
@@ -218,5 +218,5 @@
             return this->set(this->valueVector_.size(), input);
 
-        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+        orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
         return false;
     }
@@ -241,8 +241,8 @@
                 return true;
             }
-            COUT(1) << "Error: Invalid vector-index." << std::endl;
-        }
-
-        COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << std::endl;
+            orxout(user_error, context::config) << "Invalid vector-index." << endl;
+        }
+
+        orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
         return false;
     }
@@ -312,9 +312,9 @@
             if (!success)
             {
-                COUT(1) << "Error: Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << std::endl;
+                orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << endl;
             }
             else
             {
-                COUT(1) << "Error: Invalid vector-index." << std::endl;
+                orxout(user_error, context::config) << "Invalid vector-index." << endl;
             }
             return false;
Index: code/trunk/src/libraries/core/ConfigValueIncludes.h
===================================================================
--- code/trunk/src/libraries/core/ConfigValueIncludes.h	(revision 8857)
+++ code/trunk/src/libraries/core/ConfigValueIncludes.h	(revision 8858)
@@ -87,6 +87,6 @@
     @code
     MyObject orxonoxobject;
-    std::cout << "Name:    " << orxonoxobject.getName() << std::endl;
-    std::cout << "Version: " << orxonoxobject.getVersion() << std::endl;
+    orxout() << "Name:    " << orxonoxobject.getName() << endl;
+    orxout() << "Version: " << orxonoxobject.getVersion() << endl;
     @endcode
 
@@ -200,6 +200,6 @@
         else
         {
-            COUT(2) << "Warning: Couldn't reset config-value '" << entryName << "' in class '"
-                    << ClassIdentifier<T>::getIdentifier()->getName() << "', corresponding container doesn't exist." << std::endl;
+            orxout(user_warning, context::config) << "Couldn't reset config-value '" << entryName << "' in class '"
+                                                  << ClassIdentifier<T>::getIdentifier()->getName() << "', corresponding container doesn't exist." << endl;
         }
     }
@@ -238,6 +238,6 @@
     else \
     { \
-        COUT(2) << "Warning: Couln't modify config-value '" << entryName << "' in class '" \
-                << ClassByObjectType(object)->getName() << "', corresponding container doesn't exist." << std::endl; \
+        orxout(user_warning, context::config) << "Couldn't modify config-value '" << entryName << "' in class '" \
+                                              << ClassByObjectType(object)->getName() << "', corresponding container doesn't exist." << endl; \
     }
 
Index: code/trunk/src/libraries/core/Core.cc
===================================================================
--- code/trunk/src/libraries/core/Core.cc	(revision 8857)
+++ code/trunk/src/libraries/core/Core.cc	(revision 8858)
@@ -52,6 +52,7 @@
 
 #include "util/Clock.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
+#include "util/output/LogWriter.h"
 #include "util/Scope.h"
 #include "util/ScopedSingletonManager.h"
@@ -111,4 +112,6 @@
         , destructionHelper_(this)
     {
+        orxout(internal_status) << "initializing Core object..." << endl;
+
         // Set the hard coded fixed paths
         this->pathConfig_ = new PathConfig();
@@ -118,4 +121,5 @@
 
         // Load modules
+        orxout(internal_info) << "Loading modules:" << endl;
         const std::vector<std::string>& modulePaths = this->pathConfig_->getModulePaths();
         for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)
@@ -127,5 +131,5 @@
             catch (...)
             {
-                COUT(1) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << std::endl;
+                orxout(user_error) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << endl;
             }
         }
@@ -136,4 +140,12 @@
         // Set configurable paths like log, config and media
         this->pathConfig_->setConfigurablePaths();
+
+        orxout(internal_info) << "Root path:       " << PathConfig::getRootPathString() << endl;
+        orxout(internal_info) << "Executable path: " << PathConfig::getExecutablePathString() << endl;
+        orxout(internal_info) << "Data path:       " << PathConfig::getDataPathString() << endl;
+        orxout(internal_info) << "Ext. data path:  " << PathConfig::getExternalDataPathString() << endl;
+        orxout(internal_info) << "Config path:     " << PathConfig::getConfigPathString() << endl;
+        orxout(internal_info) << "Log path:        " << PathConfig::getLogPathString() << endl;
+        orxout(internal_info) << "Modules path:    " << PathConfig::getModulePathString() << endl;
 
         // create a signal handler (only active for Linux)
@@ -141,7 +153,4 @@
         this->signalHandler_ = new SignalHandler();
         this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
-
-        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used
-        OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString());
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -155,4 +164,5 @@
 
         // Manage ini files and set the default settings file (usually orxonox.ini)
+        orxout(internal_info) << "Loading config:" << endl;
         this->configFileManager_ = new ConfigFileManager();
         this->configFileManager_->setFilename(ConfigFileType::Settings,
@@ -160,4 +170,5 @@
 
         // Required as well for the config values
+        orxout(internal_info) << "Loading language:" << endl;
         this->languageInstance_ = new Language();
 
@@ -165,7 +176,9 @@
         // possibility to configure everything below here
         RegisterRootObject(Core);
+        orxout(internal_info) << "configuring Core" << endl;
         this->setConfigValues();
-        // Rewrite the log file with the correct log levels
-        OutputHandler::getInstance().rewriteLogFile();
+
+        // Set the correct log path and rewrite the log file with the correct log levels
+        LogWriter::getInstance().setLogPath(PathConfig::getLogPathString());
 
 #if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN)
@@ -176,11 +189,16 @@
         }
         if (this->bStartIOConsole_)
+        {
+            orxout(internal_info) << "creating IO console" << endl;
             this->ioConsole_ = new IOConsole();
+        }
 #endif
 
         // creates the class hierarchy for all classes with factories
+        orxout(internal_info) << "creating class hierarchy" << endl;
         Identifier::createClassHierarchy();
 
         // Load OGRE excluding the renderer and the render window
+        orxout(internal_info) << "creating GraphicsManager:" << endl;
         this->graphicsManager_ = new GraphicsManager(false);
 
@@ -190,4 +208,5 @@
 
         // Create singletons that always exist (in other libraries)
+        orxout(internal_info) << "creating root scope:" << endl;
         this->rootScope_ = new Scope<ScopeID::Root>();
 
@@ -204,10 +223,14 @@
             }
             else
-                COUT(0) << "Error: Could not open file for documentation writing" << endl;
-        }
+                orxout(internal_error) << "Could not open file for documentation writing" << endl;
+        }
+
+        orxout(internal_status) << "finished initializing Core object" << endl;
     }
 
     void Core::destroy()
     {
+        orxout(internal_status) << "destroying Core object..." << endl;
+
         // Remove us from the object lists again to avoid problems when destroying them
         this->unregisterObject();
@@ -228,10 +251,6 @@
         safeObjectDelete(&dynLibManager_);
         safeObjectDelete(&pathConfig_);
-    }
-
-    namespace DefaultLevelLogFile
-    {
-        const OutputLevel::Value Dev  = OutputLevel::Debug;
-        const OutputLevel::Value User = OutputLevel::Info;
+
+        orxout(internal_status) << "finished destroying Core object" << endl;
     }
 
@@ -239,10 +258,22 @@
     void Core::setConfigValues()
     {
-        // Choose the default level according to the path Orxonox was started (build directory or not)
-        OutputLevel::Value defaultLogLevel = (PathConfig::buildDirectoryRun() ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
-
-        SetConfigValueExternal(debugLevelLogFile_, "OutputHandler", "debugLevelLogFile", defaultLogLevel)
-            .description("The maximum level of debug output written to the log file");
-        OutputHandler::getInstance().setSoftDebugLevel("LogFile", debugLevelLogFile_);
+        SetConfigValueExternal(LogWriter::getInstance().configurableMaxLevel_,
+                               LogWriter::getInstance().getConfigurableSectionName(),
+                               LogWriter::getInstance().getConfigurableMaxLevelName(),
+                               LogWriter::getInstance().configurableMaxLevel_)
+            .description("The maximum level of output shown in the log file")
+            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableLevel);
+        SetConfigValueExternal(LogWriter::getInstance().configurableAdditionalContextsMaxLevel_,
+                               LogWriter::getInstance().getConfigurableSectionName(),
+                               LogWriter::getInstance().getConfigurableAdditionalContextsMaxLevelName(),
+                               LogWriter::getInstance().configurableAdditionalContextsMaxLevel_)
+            .description("The maximum level of output shown in the log file for additional contexts")
+            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableAdditionalContextsLevel);
+        SetConfigValueExternal(LogWriter::getInstance().configurableAdditionalContexts_,
+                               LogWriter::getInstance().getConfigurableSectionName(),
+                               LogWriter::getInstance().getConfigurableAdditionalContextsName(),
+                               LogWriter::getInstance().configurableAdditionalContexts_)
+            .description("Additional output contexts shown in the log file")
+            .callback(static_cast<BaseWriter*>(&LogWriter::getInstance()), &BaseWriter::changedConfigurableAdditionalContexts);
 
         SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
@@ -279,15 +310,4 @@
     void Core::devModeChanged()
     {
-        bool isNormal = (bDevMode_ == PathConfig::buildDirectoryRun());
-        if (isNormal)
-        {
-            ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", update);
-        }
-        else
-        {
-            OutputLevel::Value level = (bDevMode_ ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
-            ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", tset, level);
-        }
-
         // Inform listeners
         ObjectList<DevModeListener>::iterator it = ObjectList<DevModeListener>::begin();
@@ -316,4 +336,6 @@
     void Core::loadGraphics()
     {
+        orxout(internal_info) << "loading graphics in Core" << endl;
+        
         // Any exception should trigger this, even in upgradeToGraphics (see its remarks)
         Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
@@ -327,5 +349,5 @@
         {
             // Exit the application if the Ogre config dialog was canceled
-            COUT(1) << Exception::handleMessage() << std::endl;
+            orxout(user_error) << Exception::handleMessage() << endl;
             exit(EXIT_FAILURE);
         }
@@ -338,7 +360,7 @@
             // and reloaded between throw and catch (access violation in MSVC).
             // That's why we abort completely and only display the exception.
-            COUT(1) << "An exception occurred during upgrade to graphics. "
-                    << "That is unrecoverable. The message was:" << endl
-                    << Exception::handleMessage() << endl;
+            orxout(user_error) << "An exception occurred during upgrade to graphics. "
+                               << "That is unrecoverable. The message was:" << endl
+                               << Exception::handleMessage() << endl;
             abort();
         }
@@ -357,11 +379,16 @@
 
         // Create singletons associated with graphics (in other libraries)
+        orxout(internal_info) << "creating graphics scope:" << endl;
         graphicsScope_ = new Scope<ScopeID::Graphics>();
 
         unloader.Dismiss();
+
+        orxout(internal_info) << "finished loading graphics in Core" << endl;
     }
 
     void Core::unloadGraphics()
     {
+        orxout(internal_info) << "unloading graphics in Core" << endl;
+
         safeObjectDelete(&graphicsScope_);
         safeObjectDelete(&guiManager_);
@@ -374,7 +401,7 @@
         catch (...)
         {
-            COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl
-                    << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl
-                    << "Terminating the program." << std::endl;
+            orxout(user_error) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << endl
+                               << "Another exception might be being handled which may lead to undefined behaviour!" << endl
+                               << "Terminating the program." << endl;
             abort();
         }
Index: code/trunk/src/libraries/core/Core.h
===================================================================
--- code/trunk/src/libraries/core/Core.h	(revision 8857)
+++ code/trunk/src/libraries/core/Core.h	(revision 8858)
@@ -136,5 +136,4 @@
 
             bool                      bGraphicsLoaded_;
-            int                       debugLevelLogFile_;          //!< The debug level for the log file (belongs to OutputHandler)
             std::string               language_;                   //!< The language
             bool                      bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
Index: code/trunk/src/libraries/core/CoreIncludes.h
===================================================================
--- code/trunk/src/libraries/core/CoreIncludes.h	(revision 8857)
+++ code/trunk/src/libraries/core/CoreIncludes.h	(revision 8858)
@@ -34,5 +34,5 @@
 /**
     @file
-    @ingroup Object Factory
+    @ingroup Object Factory Class Identifier
     @brief Defines several very important macros used to register objects, create factories, and to work with identifiers.
 
@@ -78,5 +78,5 @@
 #include "CorePrereqs.h"
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "Identifier.h"
 #include "ClassFactory.h"
Index: code/trunk/src/libraries/core/CorePrecompiledHeaders.h
===================================================================
--- code/trunk/src/libraries/core/CorePrecompiledHeaders.h	(revision 8857)
+++ code/trunk/src/libraries/core/CorePrecompiledHeaders.h	(revision 8858)
@@ -51,5 +51,5 @@
 #include <set>      // 50
 
-#include "util/Debug.h" // 48
+#include "util/Output.h" // 48
 
 #include <deque>    // 43
Index: code/trunk/src/libraries/core/DynLib.cc
===================================================================
--- code/trunk/src/libraries/core/DynLib.cc	(revision 8857)
+++ code/trunk/src/libraries/core/DynLib.cc	(revision 8858)
@@ -68,5 +68,5 @@
     {
         // Log library load
-        COUT(2) << "Loading module " << mName << std::endl;
+        orxout(internal_info) << "Loading module " << mName << endl;
 
         std::string name = mName;
@@ -99,5 +99,5 @@
     {
         // Log library unload
-        COUT(4) << "Unloading module " << mName << std::endl;
+        orxout(internal_info) << "Unloading module " << mName << endl;
 
         if (DYNLIB_UNLOAD( m_hInst ))
Index: code/trunk/src/libraries/core/Event.cc
===================================================================
--- code/trunk/src/libraries/core/Event.cc	(revision 8857)
+++ code/trunk/src/libraries/core/Event.cc	(revision 8858)
@@ -49,5 +49,5 @@
         if (this->bProcessingEvent_)
         {
-            COUT(2) << "Warning: Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << '"' << std::endl;
+            orxout(internal_warning, context::events) << "Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << '"' << endl;
             return;
         }
@@ -55,5 +55,5 @@
         this->bProcessingEvent_ = true;
 
-        COUT(4) << "Processing event (EventState) : originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << "), activate: " << event.activate_ << ", name: " << event.name_ << ", statename: " << event.statename_ << ", object: " << object->getIdentifier()->getName() << " (&" << object << ")" << "." << std::endl;
+        orxout(verbose, context::events) << "Processing event (EventState) : originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << "), activate: " << event.activate_ << ", name: " << event.name_ << ", statename: " << event.statename_ << ", object: " << object->getIdentifier()->getName() << " (&" << object << ")" << "." << endl;
 
         // check if the originator is an instance of the requested class
Index: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc	(revision 8857)
+++ code/trunk/src/libraries/core/GUIManager.cc	(revision 8858)
@@ -73,8 +73,9 @@
 #include "util/Clock.h"
 #include "util/Convert.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "util/Math.h"
 #include "util/OrxAssert.h"
+#include "util/output/BaseWriter.h"
 #include "ConfigValueIncludes.h"
 #include "Core.h"
@@ -101,16 +102,16 @@
         void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
         {
-            int orxonoxLevel = CEGUI::Standard;
+            OutputLevel orxonoxLevel = level::debug_output;
             switch (level)
             {
-                case CEGUI::Errors:      orxonoxLevel = 1; break;
-                case CEGUI::Warnings:    orxonoxLevel = 2; break;
-                case CEGUI::Standard:    orxonoxLevel = 4; break;
-                case CEGUI::Informative: orxonoxLevel = 5; break;
-                case CEGUI::Insane:      orxonoxLevel = 6; break;
+                case CEGUI::Errors:      orxonoxLevel = level::internal_error; break;
+                case CEGUI::Warnings:    orxonoxLevel = level::internal_warning; break;
+                case CEGUI::Standard:    orxonoxLevel = level::verbose; break;
+                case CEGUI::Informative: orxonoxLevel = level::verbose_more; break;
+                case CEGUI::Insane:      orxonoxLevel = level::verbose_ultra; break;
                 default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!");
             }
-            OutputHandler::getOutStream(orxonoxLevel)
-                << "CEGUI: " << message << std::endl;
+
+            orxout(orxonoxLevel, context::cegui) << message << endl;
 
             CEGUI::DefaultLogger::logEvent(message, level);
@@ -256,12 +257,15 @@
     {
         RegisterRootObject(GUIManager);
+
+        orxout(internal_status) << "initializing GUIManager..." << endl;
+
         this->setConfigValues();
 
         using namespace CEGUI;
 
-        COUT(3) << "Initialising CEGUI." << std::endl;
+        orxout(internal_info) << "Initialising CEGUI." << endl;
 
         this->oldCEGUI_ = false;
-        
+
         // Note: No SceneManager specified yet
 #ifdef ORXONOX_OLD_CEGUI
@@ -300,7 +304,5 @@
         std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
         ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
-        // Set the log level according to ours (translate by subtracting 1)
-        ceguiLogger->setLoggingLevel(
-            static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
+        ceguiLogger->setLoggingLevel(static_cast<CEGUI::LoggingLevel>(this->outputLevelCeguiLog_));
         this->ceguiLogger_ = ceguiLogger.release();
 
@@ -336,8 +338,12 @@
         // Set up the sheet manager in the Lua framework
         this->luaState_->doFile("SheetManager.lua");
+
+        orxout(internal_status) << "finished initializing GUIManager" << endl;
     }
 
     void GUIManager::destroy()
     {
+        orxout(internal_status) << "destroying GUIManager..." << endl;
+
         using namespace CEGUI;
 
@@ -356,14 +362,23 @@
 #endif
         safeObjectDelete(&luaState_);
+
+        orxout(internal_status) << "finished destroying GUIManager" << endl;
     }
 
     void GUIManager::setConfigValues(void)
     {
-        SetConfigValue(guiScheme_, GUIManager::defaultScheme_) .description("Changes the current GUI scheme.") .callback(this, &GUIManager::changedGUIScheme);
+        SetConfigValue(guiScheme_, GUIManager::defaultScheme_).description("Changes the current GUI scheme.").callback(this, &GUIManager::changedGUIScheme);
         SetConfigValue(numScrollLines_, 1).description("How many lines to scroll in a list if the scroll wheel is used");
+        SetConfigValueExternal(outputLevelCeguiLog_, BaseWriter::getConfigurableSectionName(), "outputLevelCeguiLog", CEGUI::Standard).description("The log level of the CEGUI log file").callback(this, &GUIManager::changedCeguiOutputLevel);
     }
 
     void GUIManager::changedGUIScheme(void)
     {
+    }
+
+    void GUIManager::changedCeguiOutputLevel()
+    {
+        if (this->ceguiLogger_)
+            this->ceguiLogger_->setLoggingLevel(static_cast<CEGUI::LoggingLevel>(this->outputLevelCeguiLog_));
     }
 
@@ -670,5 +685,5 @@
         {
             // Display the error and proceed. See @remarks why this can be dangerous.
-            COUT(1) << ex.getMessage() << std::endl;
+            orxout(internal_error) << ex.getMessage() << endl;
             return true;
         }
Index: code/trunk/src/libraries/core/GUIManager.h
===================================================================
--- code/trunk/src/libraries/core/GUIManager.h	(revision 8857)
+++ code/trunk/src/libraries/core/GUIManager.h	(revision 8858)
@@ -152,4 +152,6 @@
         bool protectedCall(FunctionType function);
 
+        void changedCeguiOutputLevel();
+
         // keyHandler functions
         void buttonPressed (const KeyEvent& evt);
@@ -168,27 +170,28 @@
 
 #ifdef ORXONOX_OLD_CEGUI
-        CEGUI::OgreCEGUIRenderer*            guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
-        CEGUI::ResourceProvider*             resourceProvider_; //!< CEGUI's resource provider
+        CEGUI::OgreCEGUIRenderer*            guiRenderer_;          //!< CEGUI's interface to the Ogre Engine
+        CEGUI::ResourceProvider*             resourceProvider_;     //!< CEGUI's resource provider
 #else
-        CEGUI::OgreRenderer*                 guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
-        CEGUI::OgreResourceProvider*         resourceProvider_; //!< CEGUI's resource provider
-        Ogre::RenderQueueListener*           rqListener_;       //!< RQ listener so we can draw UNDER Ogre overlays
+        CEGUI::OgreRenderer*                 guiRenderer_;          //!< CEGUI's interface to the Ogre Engine
+        CEGUI::OgreResourceProvider*         resourceProvider_;     //!< CEGUI's resource provider
+        Ogre::RenderQueueListener*           rqListener_;           //!< RQ listener so we can draw UNDER Ogre overlays
         CEGUI::OgreImageCodec*               imageCodec_;
 #endif
-        LuaState*                            luaState_;         //!< LuaState, access point to the Lua engine
-        CEGUI::LuaScriptModule*              scriptModule_;     //!< CEGUI's script module to use Lua
-        CEGUI::System*                       guiSystem_;        //!< CEGUI's main system
-        shared_ptr<ResourceInfo>             rootFileInfo_;     //!< Resource information about the root script
-        CEGUI::Logger*                       ceguiLogger_;      //!< CEGUI's logger to be able to log CEGUI errors in our log
-        CEGUI::Window*                       rootWindow_;       //!< Root node for all windows
-        CEGUI::Window*                       hudRootWindow_;    //!< Root node for the HUD sheets
-        CEGUI::Window*                       menuRootWindow_;   //!< Root node for the menu sheets (used by Lua)
-        std::map<std::string, PlayerInfo*>   players_;          //!< Stores the player (owner) for each GUI
-        Ogre::Camera*                        camera_;           //!< Camera used to render the scene with the GUI
+        LuaState*                            luaState_;             //!< LuaState, access point to the Lua engine
+        CEGUI::LuaScriptModule*              scriptModule_;         //!< CEGUI's script module to use Lua
+        CEGUI::System*                       guiSystem_;            //!< CEGUI's main system
+        shared_ptr<ResourceInfo>             rootFileInfo_;         //!< Resource information about the root script
+        CEGUI::Logger*                       ceguiLogger_;          //!< CEGUI's logger to be able to log CEGUI errors in our log
+        int                                  outputLevelCeguiLog_;  //!< CEGUI's log level
+        CEGUI::Window*                       rootWindow_;           //!< Root node for all windows
+        CEGUI::Window*                       hudRootWindow_;        //!< Root node for the HUD sheets
+        CEGUI::Window*                       menuRootWindow_;       //!< Root node for the menu sheets (used by Lua)
+        std::map<std::string, PlayerInfo*>   players_;              //!< Stores the player (owner) for each GUI
+        Ogre::Camera*                        camera_;               //!< Camera used to render the scene with the GUI
 
         /// Helper object that executes the surrogate destructor destroy()
         DestructionHelper<GUIManager>        destructionHelper_;
 
-        static GUIManager*                   singletonPtr_s;    //!< Singleton reference to GUIManager
+        static GUIManager*                   singletonPtr_s;        //!< Singleton reference to GUIManager
 
         // The used CEGUI scheme.
@@ -196,5 +199,5 @@
         std::string guiScheme_;
         bool oldCEGUI_;
-        
+
         int numScrollLines_; ///< How many lines to scroll in a list if the scroll wheel is used
 
Index: code/trunk/src/libraries/core/Game.cc
===================================================================
--- code/trunk/src/libraries/core/Game.cc	(revision 8857)
+++ code/trunk/src/libraries/core/Game.cc	(revision 8858)
@@ -40,5 +40,5 @@
 
 #include "util/Clock.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "util/Sleep.h"
@@ -60,8 +60,8 @@
     SetConsoleCommand("exit", &stop_game);
     static void printFPS()
-        { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; }
+        { orxout(message) << Game::getInstance().getAvgFPS() << endl; }
     SetConsoleCommand("Stats", "printFPS", &printFPS);
     static void printTickTime()
-        { COUT(0) << Game::getInstance().getAvgTickTime() << std::endl; }
+        { orxout(message) << Game::getInstance().getAvgTickTime() << endl; }
     SetConsoleCommand("Stats", "printTickTime", &printTickTime);
 
@@ -84,4 +84,6 @@
         , destructionHelper_(this)
     {
+        orxout(internal_status) << "initializing Game object..." << endl;
+
 #ifdef ORXONOX_PLATFORM_WINDOWS
         minimumSleepTime_ = 1000/*us*/;
@@ -106,4 +108,5 @@
 
         // Create the Core
+        orxout(internal_info) << "creating Core object:" << endl;
         this->core_ = new Core(cmdLine);
 
@@ -125,8 +128,12 @@
         this->loadedTopStateNode_ = this->rootStateNode_;
         this->loadedStates_.push_back(this->getState(rootStateNode_->name_));
+
+        orxout(internal_status) << "finished initializing Game object" << endl;
     }
 
     void Game::destroy()
     {
+        orxout(internal_status) << "destroying Game object..." << endl;
+
         // Remove us from the object lists again to avoid problems when destroying them
         this->unregisterObject();
@@ -139,4 +146,6 @@
         safeObjectDelete(&core_);
         safeObjectDelete(&gameClock_);
+
+        orxout(internal_status) << "finished destroying Game object..." << endl;
     }
 
@@ -163,5 +172,12 @@
     {
         if (this->requestedStateNodes_.empty())
-            COUT(0) << "Warning: Starting game without requesting GameState. This automatically terminates the program." << std::endl;
+            orxout(user_error) << "Starting game without requesting GameState. This automatically terminates the program." << endl;
+
+        // Update the GameState stack if required. We do this already here to have a properly initialized game before entering the main loop
+        this->updateGameStateStack();
+
+        orxout(user_status) << "Game loaded" << endl;
+        orxout(internal_status) << "--------------------------------------------------" << endl;
+        orxout(internal_status) << "starting main loop..." << endl;
 
         // START GAME
@@ -189,6 +205,6 @@
             catch (...)
             {
-                COUT(0) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << std::endl;
-                COUT(0) << "This should really never happen! Closing the program." << std::endl;
+                orxout(user_error) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << endl;
+                orxout(user_error) << "This should really never happen! Closing the program." << endl;
                 this->stop();
                 break;
@@ -203,6 +219,6 @@
             catch (...)
             {
-                COUT(0) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << std::endl;
-                COUT(0) << "This should really never happen! Closing the program." << std::endl;
+                orxout(user_error) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << endl;
+                orxout(user_error) << "This should really never happen! Closing the program." << endl;
                 this->stop();
                 break;
@@ -217,4 +233,7 @@
                 this->updateFPSLimiter();
         }
+
+        orxout(internal_status) << "finished main loop" << endl;
+        orxout(internal_status) << "--------------------------------------------------" << endl;
 
         // UNLOAD all remaining states
@@ -241,8 +260,8 @@
                 catch (...)
                 {
-                    COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << std::endl;
+                    orxout(user_error) << "Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << endl;
                     // All scheduled operations have now been rendered inert --> flush them and issue a warning
                     if (this->requestedStateNodes_.size() > 1)
-                        COUT(4) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
+                        orxout(internal_info) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << endl;
                     this->requestedStateNodes_.clear();
                     break;
@@ -272,7 +291,7 @@
             catch (...)
             {
-                COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << std::endl;
-                COUT(1) << "This should really never happen!" << std::endl;
-                COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl;
+                orxout(user_error) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << endl;
+                orxout(user_error) << "This should really never happen!" << endl;
+                orxout(user_error) << "Unloading all GameStates depending on the one that crashed." << endl;
                 shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
                 while (current->name_ != (*it)->getName() && current)
@@ -338,4 +357,5 @@
     void Game::stop()
     {
+        orxout(user_status) << "Exit" << endl;
         this->bAbort_ = true;
     }
@@ -355,5 +375,5 @@
         if (!this->checkState(name))
         {
-            COUT(2) << "Warning: GameState named '" << name << "' doesn't exist!" << std::endl;
+            orxout(user_warning) << "GameState named '" << name << "' doesn't exist!" << endl;
             return;
         }
@@ -361,5 +381,5 @@
         if (this->bChangingState_)
         {
-            COUT(2) << "Warning: Requesting GameStates while loading/unloading a GameState is illegal! Ignoring." << std::endl;
+            orxout(user_warning) << "Requesting GameStates while loading/unloading a GameState is illegal! Ignoring." << endl;
             return;
         }
@@ -372,5 +392,5 @@
         if (name == lastRequestedNode->name_)
         {
-            COUT(2) << "Warning: Requesting the currently active state! Ignoring." << std::endl;
+            orxout(user_warning) << "Requesting the currently active state! Ignoring." << endl;
             return;
         }
@@ -403,5 +423,5 @@
 
         if (requestedNodes.empty())
-            COUT(1) << "Error: Requested GameState transition is not allowed. Ignoring." << std::endl;
+            orxout(user_error) << "Requested GameState transition is not allowed. Ignoring." << endl;
         else
             this->requestedStateNodes_.insert(requestedStateNodes_.end(), requestedNodes.begin(), requestedNodes.end());
@@ -425,5 +445,5 @@
             this->requestState(lastRequestedNode->parent_.lock()->name_);
         else
-            COUT(2) << "Warning: Can't pop the internal dummy root GameState" << std::endl;
+            orxout(internal_warning) << "Can't pop the internal dummy root GameState" << endl;
     }
 
@@ -437,7 +457,7 @@
             std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(name);
             if (it != gameStateDeclarations_s.end())
-                COUT(1) << "Error: GameState '" << name << "' has not yet been loaded." << std::endl;
+                orxout(internal_error) << "GameState '" << name << "' has not yet been loaded." << endl;
             else
-                COUT(1) << "Error: Could not find GameState '" << name << "'." << std::endl;
+                orxout(internal_error) << "Could not find GameState '" << name << "'." << endl;
             return shared_ptr<GameState>();
         }
@@ -507,4 +527,7 @@
         if (!GameMode::showsGraphics())
         {
+            orxout(user_status) << "Loading graphics" << endl;
+            orxout(internal_info) << "loading graphics in Game" << endl;
+
             core_->loadGraphics();
             Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics);
@@ -524,4 +547,6 @@
             }
             graphicsUnloader.Dismiss();
+
+            orxout(internal_info) << "finished loading graphics in Game" << endl;
         }
     }
@@ -531,4 +556,7 @@
         if (GameMode::showsGraphics())
         {
+            orxout(user_status) << "Unloading graphics" << endl;
+            orxout(internal_info) << "unloading graphics in Game" << endl;
+
             // Destroy all the GameStates that require graphics
             for (GameStateMap::iterator it = constructedStates_.begin(); it != constructedStates_.end();)
@@ -555,4 +583,6 @@
     void Game::loadState(const std::string& name)
     {
+        orxout(internal_status) << "loading state '" << name << "'" << endl;
+
         this->bChangingState_ = true;
         LOKI_ON_BLOCK_EXIT_OBJ(*this, &Game::resetChangingState); (void)LOKI_ANONYMOUS_VARIABLE(scopeGuard);
@@ -577,4 +607,6 @@
     void Game::unloadState(const std::string& name)
     {
+        orxout(internal_status) << "unloading state '" << name << "'" << endl;
+
         this->bChangingState_ = true;
         try
@@ -589,6 +621,6 @@
         catch (...)
         {
-            COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << std::endl;
-            COUT(2) << "         There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
+            orxout(internal_warning) << "Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << endl;
+            orxout(internal_warning) << "There might be potential resource leaks involved! To avoid this, improve exception-safety." << endl;
         }
         // Check if graphics is still required
Index: code/trunk/src/libraries/core/Game.h
===================================================================
--- code/trunk/src/libraries/core/Game.h	(revision 8857)
+++ code/trunk/src/libraries/core/Game.h	(revision 8858)
@@ -47,5 +47,5 @@
 #include <boost/preprocessor/cat.hpp>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/DestructionHelper.h"
 #include "util/Singleton.h"
@@ -215,6 +215,6 @@
         else
         {
-            COUT(0) << "Error: Cannot declare two GameStates with the same name." << std::endl;
-            COUT(0) << "       Ignoring second one ('" << stateName << "')." << std::endl;
+            orxout(internal_warning) << "Cannot declare two GameStates with the same name." << endl;
+            orxout(internal_warning) << "Ignoring second one ('" << stateName << "')." << endl;
         }
 
Index: code/trunk/src/libraries/core/GameState.cc
===================================================================
--- code/trunk/src/libraries/core/GameState.cc	(revision 8857)
+++ code/trunk/src/libraries/core/GameState.cc	(revision 8858)
@@ -35,5 +35,4 @@
 #include "GameState.h"
 
-#include "util/Debug.h"
 #include "util/Exception.h"
 #include "util/OrxAssert.h"
Index: code/trunk/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.cc	(revision 8857)
+++ code/trunk/src/libraries/core/GraphicsManager.cc	(revision 8858)
@@ -104,4 +104,5 @@
         RegisterObject(GraphicsManager);
 
+        orxout(internal_status) << "initializing GraphicsManager..." << endl;
         this->setConfigValues();
 
@@ -114,5 +115,5 @@
         resources_.reset(new XMLFile("DefaultResources.oxr"));
         resources_->setLuaSupport(false);
-        Loader::open(resources_.get());
+        Loader::open(resources_.get(), ClassTreeMask(), false);
 
         // Only for runs in the build directory (not installed)
@@ -122,5 +123,5 @@
         extResources_.reset(new XMLFile("resources.oxr"));
         extResources_->setLuaSupport(false);
-        Loader::open(extResources_.get());
+        Loader::open(extResources_.get(), ClassTreeMask(), false);
 
         if (bLoadRenderer)
@@ -129,8 +130,12 @@
             this->upgradeToGraphics();
         }
+
+        orxout(internal_status) << "finished initializing GraphicsManager" << endl;
     }
 
     void GraphicsManager::destroy()
     {
+        orxout(internal_status) << "destroying GraphicsManager..." << endl;
+
         Loader::unload(debugOverlay_.get());
 
@@ -148,4 +153,6 @@
         safeObjectDelete(&ogreLogger_);
         safeObjectDelete(&ogreWindowEventListener_);
+
+        orxout(internal_status) << "finished destroying GraphicsManager" << endl;
     }
 
@@ -158,10 +165,4 @@
         SetConfigValue(ogreLogFile_,     "ogre.log")
             .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
-        SetConfigValue(ogreLogLevelTrivial_ , 5)
-            .description("Corresponding orxonox debug level for ogre Trivial");
-        SetConfigValue(ogreLogLevelNormal_  , 4)
-            .description("Corresponding orxonox debug level for ogre Normal");
-        SetConfigValue(ogreLogLevelCritical_, 2)
-            .description("Corresponding orxonox debug level for ogre Critical");
     }
 
@@ -179,4 +180,6 @@
             return;
 
+        orxout(internal_info) << "GraphicsManager upgrade to graphics" << endl;
+
         // load all the required plugins for Ogre
         this->loadOgrePlugins();
@@ -189,4 +192,6 @@
         // choose another resource group.
         Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+
+        orxout(internal_info) << "GraphicsManager finished upgrade to graphics" << endl;
     }
 
@@ -197,14 +202,14 @@
     void GraphicsManager::loadOgreRoot()
     {
-        COUT(3) << "Setting up Ogre..." << std::endl;
+        orxout(internal_info) << "Setting up Ogre..." << endl;
 
         if (ogreConfigFile_.empty())
         {
-            COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
+            orxout(internal_warning) << "Ogre config file set to \"\". Defaulting to config.cfg" << endl;
             ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
         }
         if (ogreLogFile_.empty())
         {
-            COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
+            orxout(internal_warning) << "Ogre log file set to \"\". Defaulting to ogre.log" << endl;
             ModifyConfigValue(ogreLogFile_, tset, "ogre.log");
         }
@@ -216,15 +221,15 @@
         // Ogre::Root will detect that we've already created a Log
         ogreLogger_ = new Ogre::LogManager();
-        COUT(4) << "Ogre LogManager created" << std::endl;
+        orxout(internal_info) << "Ogre LogManager created" << endl;
 
         // create our own log that we can listen to
         Ogre::Log *myLog;
         myLog = ogreLogger_->createLog(ogreLogFilepath.string(), true, false, false);
-        COUT(4) << "Ogre Log created" << std::endl;
+        orxout(internal_info) << "Ogre Log created" << endl;
 
         myLog->setLogDetail(Ogre::LL_BOREME);
         myLog->addListener(this);
 
-        COUT(4) << "Creating Ogre Root..." << std::endl;
+        orxout(internal_info) << "Creating Ogre Root..." << endl;
 
         // check for config file existence because Ogre displays (caught) exceptions if not
@@ -240,9 +245,11 @@
         ogreRoot_ = new Ogre::Root("", ogreConfigFilepath.string(), ogreLogFilepath.string());
 
-        COUT(3) << "Ogre set up done." << std::endl;
+        orxout(internal_info) << "Ogre set up done." << endl;
     }
 
     void GraphicsManager::loadOgrePlugins()
     {
+        orxout(internal_info) << "loading ogre plugins" << endl;
+
         // Plugin path can have many different locations...
         std::string pluginPath = specialConfig::ogrePluginsDirectory;
@@ -277,9 +284,9 @@
     void GraphicsManager::loadRenderer()
     {
-        CCOUT(4) << "Configuring Renderer" << std::endl;
+        orxout(internal_info) << "GraphicsManager: Configuring Renderer" << endl;
 
         bool updatedConfig = Core::getInstance().getOgreConfigTimestamp() > Core::getInstance().getLastLevelTimestamp();
         if (updatedConfig)
-            COUT(2) << "Ogre config file has changed, but no level was started since then. Displaying config dialogue again to verify the changes." << std::endl;
+            orxout(user_info)<< "Ogre config file has changed, but no level was started since then. Displaying config dialogue again to verify the changes." << endl;
 
         if (!ogreRoot_->restoreConfig() || updatedConfig)
@@ -291,5 +298,5 @@
         }
 
-        CCOUT(4) << "Creating render window" << std::endl;
+        orxout(internal_info) << "Creating render window" << endl;
 
         this->renderWindow_ = ogreRoot_->initialise(true, "Orxonox");
@@ -317,7 +324,7 @@
     {
         // Load debug overlay to show info about fps and tick time
-        COUT(4) << "Loading Debug Overlay..." << std::endl;
+        orxout(internal_info) << "Loading Debug Overlay..." << endl;
         debugOverlay_.reset(new XMLFile("debug.oxo"));
-        Loader::open(debugOverlay_.get());
+        Loader::open(debugOverlay_.get(), ClassTreeMask(), false);
     }
 
@@ -396,10 +403,10 @@
         Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName)
     {
-        int orxonoxLevel;
+        OutputLevel orxonoxLevel;
         std::string introduction;
         // Do not show caught OGRE exceptions in front
         if (message.find("EXCEPTION") != std::string::npos)
         {
-            orxonoxLevel = OutputLevel::Debug;
+            orxonoxLevel = level::internal_error;
             introduction = "Ogre, caught exception: ";
         }
@@ -409,19 +416,19 @@
             {
             case Ogre::LML_TRIVIAL:
-                orxonoxLevel = this->ogreLogLevelTrivial_;
+                orxonoxLevel = level::verbose_more;
                 break;
             case Ogre::LML_NORMAL:
-                orxonoxLevel = this->ogreLogLevelNormal_;
+                orxonoxLevel = level::verbose;
                 break;
             case Ogre::LML_CRITICAL:
-                orxonoxLevel = this->ogreLogLevelCritical_;
+                orxonoxLevel = level::internal_warning;
                 break;
             default:
-                orxonoxLevel = 0;
+                orxonoxLevel = level::debug_output;
             }
             introduction = "Ogre: ";
         }
-        OutputHandler::getOutStream(orxonoxLevel)
-            << introduction << message << std::endl;
+
+        orxout(orxonoxLevel, context::ogre) << introduction << message << endl;
     }
 
Index: code/trunk/src/libraries/core/GraphicsManager.h
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.h	(revision 8857)
+++ code/trunk/src/libraries/core/GraphicsManager.h	(revision 8858)
@@ -134,7 +134,4 @@
         std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
         std::string         ogreLogFile_;              //!< log filename for Ogre log messages
-        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonox debug level for LL_TRIVIAL
-        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonox debug level for LL_NORMAL
-        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonox debug level for LL_CRITICAL
 
         /// Helper object that executes the surrogate destructor destroy()
Index: code/trunk/src/libraries/core/Identifier.cc
===================================================================
--- code/trunk/src/libraries/core/Identifier.cc	(revision 8857)
+++ code/trunk/src/libraries/core/Identifier.cc	(revision 8858)
@@ -130,5 +130,5 @@
         {
             // If no: We have to store the information and initialize the Identifier
-            COUT(4) << "*** ClassIdentifier: Register Class in " << this->getName() << "-Singleton -> Initialize Singleton." << std::endl;
+            orxout(verbose, context::identifier) << "Register Class in ClassIdentifier<" << this->getName() << ">-Singleton -> Initialize Singleton." << endl;
             if (bRootClass)
                 this->initialize(0); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
@@ -144,5 +144,5 @@
     void Identifier::initialize(std::set<const Identifier*>* parents)
     {
-        COUT(4) << "*** Identifier: Initialize " << this->name_ << "-Singleton." << std::endl;
+        orxout(verbose, context::identifier) << "Initialize ClassIdentifier<" << this->name_ << ">-Singleton." << endl;
         this->bCreatedOneObject_ = true;
 
@@ -191,5 +191,5 @@
     void Identifier::createClassHierarchy()
     {
-        COUT(3) << "*** Identifier: Create class-hierarchy" << std::endl;
+        orxout(internal_status) << "Create class-hierarchy" << endl;
         Identifier::startCreatingHierarchy();
         for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMap().begin(); it != Identifier::getStringIdentifierMap().end(); ++it)
@@ -203,5 +203,5 @@
         }
         Identifier::stopCreatingHierarchy();
-        COUT(3) << "*** Identifier: Finished class-hierarchy creation" << std::endl;
+        orxout(internal_status) << "Finished class-hierarchy creation" << endl;
     }
 
@@ -242,7 +242,7 @@
         else
         {
-            COUT(1) << "An error occurred in Identifier.cc:" << std::endl;
-            COUT(1) << "Error: Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << std::endl;
-            COUT(1) << "Aborting..." << std::endl;
+            orxout(user_error) << "An error occurred in Identifier.cc:" << endl;
+            orxout(user_error) << "Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << endl;
+            orxout(user_error) << "Aborting..." << endl;
             abort();
             return 0;
@@ -404,5 +404,5 @@
         if (it != this->configValues_.end())
         {
-            COUT(2) << "Warning: Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << std::endl;
+            orxout(internal_warning) << "Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << endl;
             delete (it->second);
         }
@@ -450,5 +450,5 @@
         if (it != this->xmlportParamContainers_.end())
         {
-            COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << '.' << std::endl;
+            orxout(internal_warning) << "Overwriting XMLPortParamContainer in class " << this->getName() << '.' << endl;
             delete (it->second);
         }
@@ -481,5 +481,5 @@
         if (it != this->xmlportObjectContainers_.end())
         {
-            COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << std::endl;
+            orxout(internal_warning) << "Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << endl;
             delete (it->second);
         }
Index: code/trunk/src/libraries/core/Identifier.h
===================================================================
--- code/trunk/src/libraries/core/Identifier.h	(revision 8857)
+++ code/trunk/src/libraries/core/Identifier.h	(revision 8858)
@@ -64,5 +64,5 @@
     for (Iterator<BaseObject> it = objects.begin(); it != objects.end(); ++it)  // iterate through the objects
         ++count;
-    COUT(0) << count << std::endl;                                              // prints "2" because we created 2 instances of MyClass so far
+    orxout() << count << endl;                                                  // prints "2" because we created 2 instances of MyClass so far
 
 
@@ -89,5 +89,5 @@
 #include <loki/TypeTraits.h>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "MetaObjectList.h"
 #include "ObjectList.h"
@@ -405,9 +405,9 @@
         if (ClassIdentifier<T>::classIdentifier_s == proposal)
         {
-            COUT(4) << "*** Identifier: Requested Identifier for " << name << " was not yet existing and got created." << std::endl;
+            orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was not yet existing and got created." << endl;
         }
         else
         {
-            COUT(4) << "*** Identifier: Requested Identifier for " << name << " was already existing and got assigned." << std::endl;
+            orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was already existing and got assigned." << endl;
         }
     }
@@ -423,7 +423,7 @@
     {
         if (bRootClass)
-            COUT(5) << "*** Register Root-Object: " << className << std::endl;
+            orxout(verbose, context::object_list) << "Register Root-Object: " << className << endl;
         else
-            COUT(5) << "*** Register Object: " << className << std::endl;
+            orxout(verbose, context::object_list) << "Register Object: " << className << endl;
 
         object->identifier_ = this;
@@ -444,5 +444,5 @@
         else
         {
-            COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
+            orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
             object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
 
Index: code/trunk/src/libraries/core/Language.cc
===================================================================
--- code/trunk/src/libraries/core/Language.cc	(revision 8857)
+++ code/trunk/src/libraries/core/Language.cc	(revision 8858)
@@ -35,5 +35,5 @@
 
 #include <fstream>
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/StringUtils.h"
 #include "Core.h"
@@ -131,5 +131,5 @@
         }
 
-        COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << '!' << std::endl;
+        orxout(internal_warning, context::language) << "Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << '!' << endl;
         return it->second;
     }
@@ -142,5 +142,5 @@
     void Language::addEntry(const LanguageEntryLabel& label, const std::string& entry)
     {
-        COUT(5) << "Language: Called addEntry with\n  label: " << label << "\n  entry: " <<  entry << std::endl;
+        orxout(verbose, context::language) << "Called addEntry with" << '\n' << "label: " << label << '\n' << "entry: " <<  entry << endl;
         std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(label);
         if (it == this->languageEntries_.end())
@@ -179,5 +179,5 @@
         {
             // Uh, oh, an undefined entry was requested: return the default string
-            COUT(2) << "Warning: Language entry \"" << label << "\" not found!" << std::endl;
+            orxout(internal_warning, context::language) << "Language entry \"" << label << "\" not found!" << endl;
             return this->defaultLocalisation_;
         }
@@ -201,5 +201,5 @@
     void Language::readDefaultLanguageFile()
     {
-        COUT(4) << "Read default language file." << std::endl;
+        orxout(internal_info, context::language) << "Read default language file." << endl;
 
         const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
@@ -216,6 +216,6 @@
         if (!file.is_open())
         {
-            COUT(1) << "An error occurred in Language.cc:" << std::endl;
-            COUT(1) << "Error: Couldn't open file " << getFilename(this->defaultLanguage_) << " to read the default language entries!" << std::endl;
+            orxout(internal_error, context::language) << "An error occurred in Language.cc:" << endl;
+            orxout(internal_error, context::language) << "Couldn't open file " << getFilename(this->defaultLanguage_) << " to read the default language entries!" << endl;
             return;
         }
@@ -237,5 +237,5 @@
                 else
                 {
-                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(this->defaultLanguage_) << std::endl;
+                    orxout(internal_warning, context::language) << "Invalid language entry \"" << lineString << "\" in " << getFilename(this->defaultLanguage_) << endl;
                 }
             }
@@ -250,5 +250,5 @@
     void Language::readTranslatedLanguageFile()
     {
-        COUT(4) << "Read translated language file (" << Core::getInstance().getLanguage() << ")." << std::endl;
+        orxout(internal_info, context::language) << "Read translated language file (" << Core::getInstance().getLanguage() << ")." << endl;
 
         const std::string& filepath = PathConfig::getConfigPathString() + getFilename(Core::getInstance().getLanguage());
@@ -260,8 +260,8 @@
         if (!file.is_open())
         {
-            COUT(1) << "An error occurred in Language.cc:" << std::endl;
-            COUT(1) << "Error: Couldn't open file " << getFilename(Core::getInstance().getLanguage()) << " to read the translated language entries!" << std::endl;
+            orxout(internal_error, context::language) << "An error occurred in Language.cc:" << endl;
+            orxout(internal_error, context::language) << "Couldn't open file " << getFilename(Core::getInstance().getLanguage()) << " to read the translated language entries!" << endl;
             Core::getInstance().resetLanguage();
-            COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << '.' << std::endl;
+            orxout(internal_info, context::language) << "Reset language to " << this->defaultLanguage_ << '.' << endl;
             return;
         }
@@ -291,5 +291,5 @@
                 else
                 {
-                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(Core::getInstance().getLanguage()) << std::endl;
+                    orxout(internal_warning, context::language) << "Invalid language entry \"" << lineString << "\" in " << getFilename(Core::getInstance().getLanguage()) << endl;
                 }
             }
@@ -304,5 +304,5 @@
     void Language::writeDefaultLanguageFile() const
     {
-        COUT(4) << "Language: Write default language file." << std::endl;
+        orxout(verbose, context::language) << "Write default language file." << endl;
 
         const std::string& filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_);
@@ -314,6 +314,6 @@
         if (!file.is_open())
         {
-            COUT(1) << "An error occurred in Language.cc:" << std::endl;
-            COUT(1) << "Error: Couldn't open file " << getFilename(this->defaultLanguage_) << " to write the default language entries!" << std::endl;
+            orxout(internal_error, context::language) << "An error occurred in Language.cc:" << endl;
+            orxout(internal_error, context::language) << "Couldn't open file " << getFilename(this->defaultLanguage_) << " to write the default language entries!" << endl;
             return;
         }
@@ -322,5 +322,5 @@
         for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
         {
-            file << it->second->getLabel() << '=' << it->second->getDefault() << std::endl;
+            file << it->second->getLabel() << '=' << it->second->getDefault() << endl;
         }
 
Index: code/trunk/src/libraries/core/Language.h
===================================================================
--- code/trunk/src/libraries/core/Language.h	(revision 8857)
+++ code/trunk/src/libraries/core/Language.h	(revision 8858)
@@ -51,5 +51,5 @@
      - Get the localisation of the entry in the configured language:
        @code
-       std::cout << Language::getInstance()->getLocalisation("name of the entry") << std::endl;
+       orxout() << Language::getInstance()->getLocalisation("name of the entry") << endl;
        @endcode
 
@@ -58,5 +58,5 @@
     int age = 20;
     AddLanguageEntry("user_age", "Age");
-    std::cout << GetLocalisation("user_age") << ": " << age << std::endl;
+    orxout() << GetLocalisation("user_age") << ": " << age << endl;
     @endcode
 
Index: code/trunk/src/libraries/core/Loader.cc
===================================================================
--- code/trunk/src/libraries/core/Loader.cc	(revision 8857)
+++ code/trunk/src/libraries/core/Loader.cc	(revision 8858)
@@ -33,5 +33,5 @@
 #include <boost/scoped_ptr.hpp>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "util/StringUtils.h"
@@ -49,8 +49,8 @@
     ClassTreeMask Loader::currentMask_s;
 
-    bool Loader::open(const XMLFile* file, const ClassTreeMask& mask)
+    bool Loader::open(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose)
     {
         Loader::add(file, mask);
-        return Loader::load(file, mask);
+        return Loader::load(file, mask, bVerbose);
     }
 
@@ -93,14 +93,14 @@
     @param mask
         A ClassTreeMask, which defines which types of classes are loaded and which aren't.
-    @param verbose
+    @param bVerbose
         Whether the loader is verbose (prints its progress in a low output level) or not.
     @return
         Returns true if successful.
     */
-    bool Loader::load(const ClassTreeMask& mask, bool verbose)
+    bool Loader::load(const ClassTreeMask& mask, bool bVerbose)
     {
         bool success = true;
         for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = Loader::files_s.begin(); it != Loader::files_s.end(); ++it)
-            if (!Loader::load(it->first, it->second * mask, verbose))
+            if (!Loader::load(it->first, it->second * mask, bVerbose))
                 success = false;
 
@@ -124,13 +124,13 @@
     @param mask
         A ClassTreeMask, which defines which types of classes are reloaded and which aren't.
-    @param verbose
+    @param bVerbose
         Whether the loader is verbose (prints its progress in a low output level) or not.
     @return
         Returns true if successful.
     */
-    bool Loader::reload(const ClassTreeMask& mask, bool verbose)
+    bool Loader::reload(const ClassTreeMask& mask, bool bVerbose)
     {
         Loader::unload(mask);
-        return Loader::load(mask, verbose);
+        return Loader::load(mask, bVerbose);
     }
 
@@ -142,5 +142,5 @@
     @param mask
         A ClassTreeMask, which defines which types of classes are loaded and which aren't.
-    @param verbose
+    @param bVerbose
         Whether the loader is verbose (prints its progress in a low output level) or not.
     @param bRemoveLuaTags
@@ -149,5 +149,5 @@
         Returns true if successful.
     */
-    bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool verbose, bool bRemoveLuaTags)
+    bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose, bool bRemoveLuaTags)
     {
         if (!file)
@@ -170,5 +170,5 @@
             if (info == NULL)
             {
-                COUT(1) << "Error: Could not find XML file '" << file->getFilename() << "'." << std::endl;
+                orxout(user_error, context::loader) << "Could not find XML file '" << file->getFilename() << "'." << endl;
                 return false;
             }
@@ -187,13 +187,13 @@
         try
         {
-            if(verbose)
-            {
-                COUT(0) << "Start loading " << file->getFilename() << "..." << std::endl;
-                COUT(3) << "Mask: " << Loader::currentMask_s << std::endl;
-            }
-            else
-            {
-                COUT(4) << "Start loading " << file->getFilename() << "..." << std::endl;
-                COUT(4) << "Mask: " << Loader::currentMask_s << std::endl;
+            if(bVerbose)
+            {
+                orxout(user_info) << "Start loading " << file->getFilename() << "..." << endl;
+                orxout(internal_info, context::loader) << "Mask: " << Loader::currentMask_s << endl;
+            }
+            else
+            {
+                orxout(verbose, context::loader) << "Start loading " << file->getFilename() << "..." << endl;
+                orxout(verbose_more, context::loader) << "Mask: " << Loader::currentMask_s << endl;
             }
 
@@ -208,5 +208,5 @@
                 rootElement.InsertEndChild(*child);
 
-            COUT(4) << "  creating root-namespace..." << std::endl;
+            orxout(verbose, context::loader) << "  creating root-namespace..." << endl;
             Namespace* rootNamespace = new Namespace(0);
             rootNamespace->setLoaderIndentation("    ");
@@ -216,10 +216,10 @@
             rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
 
-            if(verbose)
-                COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl;
-            else
-                COUT(4) << "Finished loading " << file->getFilename() << '.' << std::endl;
-
-            COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString("  ") << std::endl;
+            if(bVerbose)
+                orxout(user_info) << "Finished loading " << file->getFilename() << '.' << endl;
+            else
+                orxout(verbose, context::loader) << "Finished loading " << file->getFilename() << '.' << endl;
+
+            orxout(verbose, context::loader) << "Namespace-tree:" << '\n' << rootNamespace->toString("  ") << endl;
 
             return true;
@@ -227,24 +227,24 @@
         catch (ticpp::Exception& ex)
         {
-            COUT(1) << std::endl;
-            COUT(1) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;
-            COUT(1) << ex.what() << std::endl;
-            COUT(1) << "Loading aborted." << std::endl;
+            orxout(user_error, context::loader) << endl;
+            orxout(user_error, context::loader) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ':' << endl;
+            orxout(user_error, context::loader) << ex.what() << endl;
+            orxout(user_error, context::loader) << "Loading aborted." << endl;
             return false;
         }
         catch (Exception& ex)
         {
-            COUT(1) << std::endl;
-            COUT(1) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;
-            COUT(1) << ex.what() << std::endl;
-            COUT(1) << "Loading aborted." << std::endl;
+            orxout(user_error, context::loader) << endl;
+            orxout(user_error, context::loader) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ':' << endl;
+            orxout(user_error, context::loader) << ex.what() << endl;
+            orxout(user_error, context::loader) << "Loading aborted." << endl;
             return false;
         }
         catch (...)
         {
-            COUT(1) << std::endl;
-            COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;
-            COUT(1) << Exception::handleMessage() << std::endl;
-            COUT(1) << "Loading aborted." << std::endl;
+            orxout(user_error, context::loader) << endl;
+            orxout(user_error, context::loader) << "An error occurred in Loader.cc while loading " << file->getFilename() << ':' << endl;
+            orxout(user_error, context::loader) << Exception::handleMessage() << endl;
+            orxout(user_error, context::loader) << "Loading aborted." << endl;
             return false;
         }
@@ -271,13 +271,13 @@
     @param mask
         A ClassTreeMask, which defines which types of classes are reloaded and which aren't.
-    @param verbose
+    @param bVerbose
         Whether the loader is verbose (prints its progress in a low output level) or not.
     @return
         Returns true if successful.
     */
-    bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool verbose)
+    bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose)
     {
         Loader::unload(file, mask);
-        return Loader::load(file, mask, verbose);
+        return Loader::load(file, mask, bVerbose);
     }
 
@@ -337,7 +337,7 @@
             if (!expectedValue)
             {
-                COUT(2) << "Warning: Error in level file" << std::endl;
+                orxout(internal_error, context::loader) << "Error in level file" << endl;
                 // TODO: error handling
-                return false; 
+                return false;
             }
         }
Index: code/trunk/src/libraries/core/Loader.h
===================================================================
--- code/trunk/src/libraries/core/Loader.h	(revision 8857)
+++ code/trunk/src/libraries/core/Loader.h	(revision 8858)
@@ -51,5 +51,5 @@
     {
         public:
-            static bool open(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
+            static bool open(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);
             static void close();
             static void close(const XMLFile* file);
@@ -58,12 +58,12 @@
             static void remove(const XMLFile* file);
 
-            static bool load(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
+            static bool load(const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);
             static void unload(const ClassTreeMask& mask = ClassTreeMask());
-            static bool reload(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
+            static bool reload(const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);
 
             static bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(),
-                             bool verbose = true, bool bRemoveLuaTags = false);
+                             bool bVerbose = true, bool bRemoveLuaTags = false);
             static void unload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
-            static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
+            static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);
 
             static std::string replaceLuaTags(const std::string& text);
Index: code/trunk/src/libraries/core/LuaState.cc
===================================================================
--- code/trunk/src/libraries/core/LuaState.cc	(revision 8857)
+++ code/trunk/src/libraries/core/LuaState.cc	(revision 8858)
@@ -37,5 +37,5 @@
 #include <loki/ScopeGuard.h>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "Resource.h"
@@ -96,5 +96,5 @@
         else
         {
-            COUT(2) << "LuaState: Cannot include file '" << filename << "' (not found)." << std::endl;
+            orxout(internal_warning, context::lua) << "LuaState: Cannot include file '" << filename << "' (not found)." << endl;
             return false;
         }
@@ -136,5 +136,5 @@
         else
         {
-            COUT(2) << "LuaState: Cannot do file '" << filename << "' (not found)." << std::endl;
+            orxout(internal_warning, context::lua) << "LuaState: Cannot do file '" << filename << "' (not found)." << endl;
             return false;
         }
@@ -176,8 +176,8 @@
         {
         case LUA_ERRSYNTAX: // Syntax error
-            COUT(1) << "Lua syntax error: " << lua_tostring(luaState_, -1) << std::endl;
+            orxout(internal_error, context::lua) << "Lua syntax error: " << lua_tostring(luaState_, -1) << endl;
             break;
         case LUA_ERRMEM:    // Memory allocation error
-            COUT(1) << "Lua memory allocation error: Consult your dentist immediately!" << std::endl;
+            orxout(internal_error, context::lua) << "Lua memory allocation error: Consult your dentist immediately!" << endl;
             break;
         }
@@ -200,12 +200,12 @@
                     std::string errorString = lua_tostring(this->luaState_, -1);
                     if (errorString.find("Error propagation") == std::string::npos)
-                        COUT(1) << "Lua runtime error: " << errorString << std::endl;
+                        orxout(internal_error, context::lua) << "Lua runtime error: " << errorString << endl;
                 }
                 break;
             case LUA_ERRERR: // Error in the error handler
-                COUT(1) << "Lua error in error handler. No message available." << std::endl;
+                orxout(internal_error, context::lua) << "Lua error in error handler. No message available." << endl;
                 break;
             case LUA_ERRMEM: // Memory allocation error
-                COUT(1) << "Lua memory allocation error: Consult your dentist immediately!" << std::endl;
+                orxout(internal_error, context::lua) << "Lua memory allocation error: Consult your dentist immediately!" << endl;
                 break;
             }
@@ -236,7 +236,17 @@
     }
 
-    void LuaState::luaLog(unsigned int level, const std::string& message)
-    {
-        OutputHandler::getOutStream(level) << message << std::endl;
+    void LuaState::luaOutput(OutputLevel level, const std::string& context, const std::string& message)
+    {
+        orxout(level, registerContext(context)) << message << endl;
+    }
+
+    void LuaState::luaOutput(OutputLevel level, const std::string& message)
+    {
+        orxout(level, context::lua) << message << endl;
+    }
+
+    void LuaState::luaOutput(const std::string& message)
+    {
+        orxout(debug_output, context::lua) << message << endl;
     }
 
@@ -288,5 +298,5 @@
             if (it->first == name || it->second == function)
             {
-                COUT(2) << "Warning: Trying to add a Tolua interface with the same name or function." << std::endl;
+                orxout(internal_warning, context::lua) << "Trying to add a Tolua interface with the same name or function." << endl;
                 return true;
             }
@@ -307,5 +317,5 @@
         if (it == getToluaInterfaces().end())
         {
-            COUT(2) << "Warning: Cannot remove Tolua interface '" << name << "': Not found" << std::endl;
+            orxout(internal_warning, context::lua) << "Cannot remove Tolua interface '" << name << "': Not found" << endl;
             return true;
         }
Index: code/trunk/src/libraries/core/LuaState.h
===================================================================
--- code/trunk/src/libraries/core/LuaState.h	(revision 8857)
+++ code/trunk/src/libraries/core/LuaState.h	(revision 8858)
@@ -49,4 +49,6 @@
 #include <boost/shared_ptr.hpp>
 
+#include "util/Output.h"
+
 namespace orxonox // tolua_export
 { // tolua_export
@@ -83,5 +85,7 @@
 
         void luaPrint(const std::string& str); // tolua_export
-        void luaLog(unsigned int level, const std::string& message); // tolua_export
+        void luaOutput(orxonox::level::OutputLevel level, const std::string& context, const std::string& message); // tolua_export
+        void luaOutput(orxonox::level::OutputLevel level, const std::string& message); // tolua_export
+        void luaOutput(const std::string& message); // tolua_export
         bool fileExists(const std::string& filename); // tolua_export
         std::string getSourceCode(const std::string& filename); // tolua_export
Index: code/trunk/src/libraries/core/MetaObjectList.cc
===================================================================
--- code/trunk/src/libraries/core/MetaObjectList.cc	(revision 8857)
+++ code/trunk/src/libraries/core/MetaObjectList.cc	(revision 8858)
@@ -34,5 +34,5 @@
 #include "MetaObjectList.h"
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "Identifier.h"
 #include "ObjectListBase.h"
@@ -48,5 +48,5 @@
     MetaObjectListElement::~MetaObjectListElement()
     {
-        COUT(5) << "*** MetaObjectList: Removing Object from " << this->list_->getIdentifier()->getName() << "-list." << std::endl;
+        orxout(verbose, context::object_list) << "Removing Object from " << this->list_->getIdentifier()->getName() << "-list." << endl;
         this->list_->notifyIterators(this->element_->objectBase_);
 
Index: code/trunk/src/libraries/core/NamespaceNode.cc
===================================================================
--- code/trunk/src/libraries/core/NamespaceNode.cc	(revision 8857)
+++ code/trunk/src/libraries/core/NamespaceNode.cc	(revision 8858)
@@ -28,5 +28,5 @@
 
 #include "NamespaceNode.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 
 namespace orxonox
@@ -70,10 +70,10 @@
                 if (this->bRoot_)
                 {
-                    COUT(2) << "Warning: Can't go to enclosing namespace with '..' operator in namespace " << this->name_ << ", namespace is root." << std::endl;
+                    orxout(internal_warning) << "Can't go to enclosing namespace with '..' operator in namespace " << this->name_ << ", namespace is root." << endl;
                     nodes = this->getNodeRelative(secondPart);
                 }
                 else if (!this->parent_)
                 {
-                    COUT(2) << "Warning: Can't go to enclosing namespace with '..' operator in namespace " << this->name_ << ", no parent namespace set." << std::endl;
+                    orxout(internal_warning) << "Can't go to enclosing namespace with '..' operator in namespace " << this->name_ << ", no parent namespace set." << endl;
                     nodes = this->getNodeRelative(secondPart);
                 }
@@ -91,5 +91,5 @@
                 if (it->second->isHidden())
                 {
-                    COUT(2) << "Warning: Subnamespace '" << firstPart << "' in namespace '" << this->name_ << "' is hidden and can't be accessed." << std::endl;
+                    orxout(internal_warning) << "Subnamespace '" << firstPart << "' in namespace '" << this->name_ << "' is hidden and can't be accessed." << endl;
                     nodes.insert(this);
                 }
@@ -115,5 +115,5 @@
                 if (!bFoundMatchingNamespace)
                 {
-                    COUT(2) << "Warning: No file included with name '" << firstPart.substr(1, std::string::npos) << "' at this part of the level file, using parent namespace instead." << std::endl;
+                    orxout(internal_warning) << "No file included with name '" << firstPart.substr(1, std::string::npos) << "' at this part of the level file, using parent namespace instead." << endl;
                     nodes = this->getNodeRelative(secondPart);
                 }
Index: code/trunk/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.cc	(revision 8857)
+++ code/trunk/src/libraries/core/OrxonoxClass.cc	(revision 8858)
@@ -60,5 +60,5 @@
     {
 //        if (!this->requestedDestruction_)
-//            COUT(2) << "Warning: Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << std::endl;
+//            orxout(internal_warning) << "Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << endl;
 
         assert(this->referenceCount_ <= 0);
Index: code/trunk/src/libraries/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.h	(revision 8857)
+++ code/trunk/src/libraries/core/OrxonoxClass.h	(revision 8858)
@@ -49,11 +49,4 @@
 #include <vector>
 #include "Super.h"
-
-/**
-@def CCOUT
-    Acts almost exactly like COUT(x), but prepends "ClassName: "
-*/
-#define CCOUT(level) \
-    COUT(level) << this->getIdentifier()->getName() << ": "
 
 namespace orxonox
Index: code/trunk/src/libraries/core/PathConfig.cc
===================================================================
--- code/trunk/src/libraries/core/PathConfig.cc	(revision 8857)
+++ code/trunk/src/libraries/core/PathConfig.cc	(revision 8858)
@@ -51,5 +51,5 @@
 
 #include "SpecialConfig.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "CommandLineParser.h"
@@ -137,5 +137,5 @@
         if (bf::exists(executablePath_ / "orxonox_dev_build.keep_me"))
         {
-            COUT(1) << "Running from the build tree." << std::endl;
+            orxout(internal_info) << "Running from the build tree." << endl;
             PathConfig::bBuildDirectoryRun_ = true;
             modulePath_ = specialConfig::moduleDevDirectory;
@@ -247,5 +247,5 @@
             if (bf::create_directories(it->first)) // function may not return true at all (bug?)
             {
-                COUT(4) << "Created " << it->second << " directory" << std::endl;
+                orxout(internal_info) << "Created " << it->second << " directory" << endl;
             }
         }
Index: code/trunk/src/libraries/core/SubclassIdentifier.h
===================================================================
--- code/trunk/src/libraries/core/SubclassIdentifier.h	(revision 8857)
+++ code/trunk/src/libraries/core/SubclassIdentifier.h	(revision 8858)
@@ -69,5 +69,5 @@
 
 #include <cstdlib>
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "Identifier.h"
 
@@ -119,13 +119,13 @@
                 if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
                 {
-                    COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
+                    orxout(internal_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
                     if (identifier)
                     {
-                        COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << std::endl;
-                        COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;
+                        orxout(internal_error) << "Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
+                        orxout(internal_error) << "SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << endl;
                     }
                     else
                     {
-                        COUT(1) << "Error: Can't assign NULL identifier" << std::endl;
+                        orxout(internal_error) << "Can't assign NULL identifier" << endl;
                     }
                 }
@@ -177,15 +177,15 @@
                     if (this->identifier_)
                     {
-                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
-                        COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << std::endl;
-                        COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;
+                        orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
+                        orxout(user_error) << "Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
+                        orxout(user_error) << "Couldn't fabricate a new Object." << endl;
                     }
                     else
                     {
-                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
-                        COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined." << std::endl;
-                    }
-
-                    COUT(1) << "Aborting..." << std::endl;
+                        orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
+                        orxout(user_error) << "Couldn't fabricate a new Object - Identifier is undefined." << endl;
+                    }
+
+                    orxout(user_error) << "Aborting..." << endl;
                     abort();
                     return 0;
Index: code/trunk/src/libraries/core/Super.h
===================================================================
--- code/trunk/src/libraries/core/Super.h	(revision 8857)
+++ code/trunk/src/libraries/core/Super.h	(revision 8858)
@@ -73,5 +73,5 @@
 
 #include "CorePrereqs.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 
 ///////////////////////
@@ -114,5 +114,5 @@
                     if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
                     { \
-                        COUT(5) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl; \
+                        orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << endl; \
                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
                     } \
@@ -184,5 +184,5 @@
                     {
                         // Add the SuperFunctionCaller
-                        COUT(5) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl;
+                        orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << endl;
                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
                     }
Index: code/trunk/src/libraries/core/Template.cc
===================================================================
--- code/trunk/src/libraries/core/Template.cc	(revision 8857)
+++ code/trunk/src/libraries/core/Template.cc	(revision 8858)
@@ -32,5 +32,5 @@
 #include <tinyxml/ticpp.h>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "CoreIncludes.h"
 #include "XMLPort.h"
@@ -88,5 +88,5 @@
             it = Template::getTemplateMap().find(this->getName());
             if (it != Template::getTemplateMap().end())
-                COUT(2) << "Warning: Template with name \"" << this->getName() << "\" already exists." << std::endl;
+                orxout(internal_warning, context::templates) << "Template with name \"" << this->getName() << "\" already exists." << endl;
             else
                 Template::getTemplateMap()[this->getName()] = this;
@@ -117,10 +117,10 @@
                 else
                 {
-                    COUT(2) << "Warning: Linking from " << this->getName() << " to " << this->link_ << " leads to an infinite loop. Returning own element." << std::endl;
+                    orxout(internal_warning, context::templates) << "Linking from \"" << this->getName() << "\" to \"" << this->link_ << "\" leads to an infinite loop. Returning own element." << endl;
                 }
             }
             else
             {
-                COUT(2) << "Warning: " << this->link_ << " is not an existing Template name. Returning own element." << std::endl;
+                orxout(internal_warning, context::templates) << '"' << this->link_ << "\" is not an existing Template name. Returning own element." << endl;
             }
         }
@@ -142,10 +142,10 @@
             if (!object->isA(this->baseclassIdentifier_))
             {
-                COUT(1) << "Error: Can't apply template (name: " << this->getName() << "), object (name: " << object->getName() << ", class: " << object->getIdentifier()->getName() << ") is not a " << this->baseclassIdentifier_->getName() << std::endl;
+                orxout(internal_error, context::templates) << "Can't apply template (name: " << this->getName() << "), object (name: " << object->getName() << ", class: " << object->getIdentifier()->getName() << ") is not a " << this->baseclassIdentifier_->getName() << endl;
                 return;
             }
         }
 
-        COUT(4) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << std::endl;
+        orxout(verbose, context::templates) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << endl;
 
         Element temp = &const_cast<TiXmlElement&>(this->getXMLElement());
@@ -170,5 +170,5 @@
         else
         {
-            COUT(2) << "Warning: Template with name " << name << " doesn't exist." << std::endl;
+            orxout(internal_warning, context::templates) << "Template with name " << name << " doesn't exist." << endl;
             return 0;
         }
Index: code/trunk/src/libraries/core/WeakPtr.h
===================================================================
--- code/trunk/src/libraries/core/WeakPtr.h	(revision 8857)
+++ code/trunk/src/libraries/core/WeakPtr.h	(revision 8858)
@@ -65,5 +65,5 @@
     void myCallback()                                   // definition of the callback function
     {
-        COUT(0) << "Object destroyed" << std::endl;
+        orxout() << "Object destroyed" << endl;
     }
 
Index: code/trunk/src/libraries/core/XMLPort.cc
===================================================================
--- code/trunk/src/libraries/core/XMLPort.cc	(revision 8857)
+++ code/trunk/src/libraries/core/XMLPort.cc	(revision 8858)
@@ -64,5 +64,5 @@
                         if (!this->sectionname_.empty())
                         {
-                            COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl;
+                            orxout(internal_warning, context::xml) << object->getLoaderIndentation() << "'" << child->Value() << "' is not a valid classname." << endl;
                         }
                         else
@@ -74,10 +74,10 @@
                     if (!identifier->isA(objectIdentifier_))
                     {
-                        COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a '" << objectIdentifier_->getName() << "'." << std::endl;
+                        orxout(internal_warning, context::xml) << object->getLoaderIndentation() << "'" << child->Value() << "' is not a '" << objectIdentifier_->getName() << "'." << endl;
                         continue;
                     }
                     if (!identifier->isLoadable())
                     {
-                        COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not loadable." << std::endl;
+                        orxout(internal_warning, context::xml) << object->getLoaderIndentation() << "'" << child->Value() << "' is not loadable." << endl;
                         continue;
                     }
@@ -87,5 +87,5 @@
                     try
                     {
-                        COUT(4) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
+                        orxout(verbose, context::xml) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << endl;
 
                         BaseObject* newObject = identifier->fabricate(object);
@@ -95,12 +95,10 @@
                         {
                             newObject->XMLPort(*child, XMLPort::LoadObject);
-                            COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl;
+                            orxout(verbose, context::xml) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << endl;
                         }
                         else
                         {
-                            COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl;
+                            orxout(verbose, context::xml) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << endl;
                         }
-
-                        COUT(5) << object->getLoaderIndentation();
 
                         this->callLoadExecutor(object, newObject);
@@ -109,15 +107,15 @@
                             newObject->XMLPort(*child, XMLPort::LoadObject);
 
-                        COUT(5) << object->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl;
+                        orxout(verbose, context::xml) << object->getLoaderIndentation() << "fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << endl;
                     }
                     catch (AbortLoadingException& ex)
                     {
-                        COUT(1) << "An error occurred while loading object, abort loading..." << std::endl;
+                        orxout(internal_error, context::xml) << "An error occurred while loading object, abort loading..." << endl;
                         throw ex;
                     }
                     catch (...)
                     {
-                        COUT(1) << "An error occurred while loading object:" << std::endl;
-                        COUT(1) << Exception::handleMessage() << std::endl;
+                        orxout(internal_error, context::xml) << "An error occurred while loading object:" << endl;
+                        orxout(internal_error, context::xml) << Exception::handleMessage() << endl;
                     }
                 }
@@ -125,7 +123,7 @@
             catch (ticpp::Exception& ex)
             {
-                COUT(1) << std::endl;
-                COUT(1) << "An error occurred in XMLPort.h while loading a '" << objectIdentifier_->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ':' << std::endl;
-                COUT(1) << ex.what() << std::endl;
+                orxout(internal_error, context::xml) << endl;
+                orxout(internal_error, context::xml) << "An error occurred in XMLPort.h while loading a '" << objectIdentifier_->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ':' << endl;
+                orxout(internal_error, context::xml) << ex.what() << endl;
             }
         }
Index: code/trunk/src/libraries/core/XMLPort.h
===================================================================
--- code/trunk/src/libraries/core/XMLPort.h	(revision 8857)
+++ code/trunk/src/libraries/core/XMLPort.h	(revision 8858)
@@ -53,5 +53,5 @@
 #include <tinyxml/ticpp.h>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "util/MultiType.h"
@@ -415,5 +415,5 @@
                         if ((!attributeValue.empty()) || ((mode != XMLPort::ExpandObject) && this->loadexecutor_->allDefaultValuesSet()))
                         {
-                            COUT(5) << this->owner_->getLoaderIndentation() << "Loading parameter " << this->paramname_ << " in " << this->identifier_->getName() << " (objectname " << this->owner_->getName() << ")." << std::endl << this->owner_->getLoaderIndentation();
+                            orxout(verbose_more, context::xml) << this->owner_->getLoaderIndentation() << "Loading parameter " << this->paramname_ << " in " << this->identifier_->getName() << " (objectname " << this->owner_->getName() << ")." << endl;
                             int error;
                             this->loadexecutor_->parse(object, attributeValue, &error, ",");
@@ -430,7 +430,7 @@
                     catch (ticpp::Exception& ex)
                     {
-                        COUT(1) << std::endl;
-                        COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getFilename() << ':' << std::endl;
-                        COUT(1) << ex.what() << std::endl;
+                        orxout(internal_error, context::xml) << endl;
+                        orxout(internal_error, context::xml) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getFilename() << ':' << endl;
+                        orxout(internal_error, context::xml) << ex.what() << endl;
                     }
                 }
Index: code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc
===================================================================
--- code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc	(revision 8858)
@@ -90,5 +90,5 @@
             ArgumentCompletionList _groupsandcommands(const std::string& fragment, bool bOnlyShowHidden)
             {
-                // note: this function returns only arguments that begin with "fragment", which would't be necessary for the
+                // note: this function returns only arguments that begin with "fragment", which wouldn't be necessary for the
                 //       auto-completion, but it's necessary to place the line-break "\n" between groups and commands
                 //       only if both groups AND commands are in the list.
@@ -100,5 +100,5 @@
                 const std::map<std::string, std::map<std::string, ConsoleCommand*> >& commands = ConsoleCommand::getCommands();
                 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)
-                    if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find_first_of(fragmentLC) == 0))
+                    if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find(fragmentLC) == 0))
                         groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first)));
 
@@ -113,5 +113,5 @@
                     // add the shortcuts
                     for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
-                        if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find_first_of(fragmentLC) == 0))
+                        if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find(fragmentLC) == 0))
                             groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
                 }
Index: code/trunk/src/libraries/core/command/CommandEvaluation.cc
===================================================================
--- code/trunk/src/libraries/core/command/CommandEvaluation.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/CommandEvaluation.cc	(revision 8858)
@@ -131,5 +131,5 @@
 
             if (!this->execCommand_)
-                *error = CommandExecutor::Error;
+                *error = CommandExecutor::Inexistent;
             else if (!this->execCommand_->isActive())
                 *error = CommandExecutor::Deactivated;
@@ -151,5 +151,5 @@
             if (this->bEvaluatedArguments_)
             {
-                COUT(6) << "CE_execute (evaluation): " << this->execCommand_->getName() << " with " << this->numberOfEvaluatedArguments_ << " arguments: " << this->arguments_[0] << ' ' << this->arguments_[1] << ' ' << this->arguments_[2] << ' ' << this->arguments_[3] << ' ' << this->arguments_[4] << std::endl;
+                orxout(verbose, context::commands) << "CE_execute (evaluation): " << this->execCommand_->getName() << " with " << this->numberOfEvaluatedArguments_ << " arguments: " << this->arguments_[0] << ' ' << this->arguments_[1] << ' ' << this->arguments_[2] << ' ' << this->arguments_[3] << ' ' << this->arguments_[4] << endl;
 
                 // pass as many arguments to the executor as were evaluated (thus the executor can still use additional default values)
@@ -186,6 +186,6 @@
         {
             if (bPrintError)
-                COUT(1) << "Error: Can't evaluate arguments, no console command assigned." << std::endl;
-            return CommandExecutor::Error;
+                orxout(internal_error, context::commands) << "Can't evaluate arguments, no console command assigned." << endl;
+            return CommandExecutor::Inexistent;
         }
 
@@ -200,5 +200,5 @@
             this->bEvaluatedArguments_ = true;
         else if (bPrintError)
-            COUT(1) << "Error: Can't evaluate arguments, not enough arguments given." << std::endl;
+            orxout(internal_error, context::commands) << "Can't evaluate arguments, not enough arguments given." << endl;
 
         return error;
Index: code/trunk/src/libraries/core/command/CommandExecutor.cc
===================================================================
--- code/trunk/src/libraries/core/command/CommandExecutor.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/CommandExecutor.cc	(revision 8858)
@@ -69,8 +69,10 @@
         @return Returns the error-code (see @ref CommandExecutorErrorCodes "error codes")
     */
-    /* static */ int CommandExecutor::execute(const std::string& command, bool useTcl)
+    /* static */ int CommandExecutor::execute(const std::string& command, bool useTcl, bool printErrors)
     {
         int error;
         CommandExecutor::queryMT(command, &error, useTcl);
+        if (error && printErrors)
+            orxout(user_error) << "Can't execute \"" << command << "\", " << CommandExecutor::getErrorDescription(error) << ". (execute)" << endl;
         return error;
     }
@@ -85,8 +87,11 @@
     /* static */ MultiType CommandExecutor::queryMT(const std::string& command, int* error, bool useTcl)
     {
+        MultiType result;
+        int error_internal;
+
         if (useTcl)
         {
             // pass the command to tcl
-            return TclBind::eval(command, error);
+            result = TclBind::eval(command, &error_internal);
         }
         else
@@ -108,6 +113,13 @@
 
             // query the command and return its return-value
-            return evaluation.query(error);
-        }
+            result = evaluation.query(&error_internal);
+        }
+
+        if (error)
+            *error = error_internal;
+        else if (error_internal)
+            orxout(user_error) << "Can't execute \"" << command << "\", " << CommandExecutor::getErrorDescription(error_internal) << ". (query)" << endl;
+
+        return result;
     }
 
@@ -172,4 +184,21 @@
 
     /**
+        @brief Returns a description of the error code.
+        @param error The error code
+    */
+    /* static */ std::string CommandExecutor::getErrorDescription(int error)
+    {
+        switch (error)
+        {
+            case CommandExecutor::Inexistent:  return "command doesn't exist";
+            case CommandExecutor::Incomplete:  return "not enough arguments given";
+            case CommandExecutor::Deactivated: return "command is not active";
+            case CommandExecutor::Denied:      return "access denied";
+            case CommandExecutor::Error:       return "an error occurred";
+            default: return "";
+        }
+    }
+
+    /**
         @brief Gets an evaluated command from the cache.
         @param command The command that should be looked up in the cache
@@ -261,5 +290,5 @@
             if ((tokens.size() == 1 && ConsoleCommand::getCommand(tokens[0])) || (tokens.size() == 2 && ConsoleCommand::getCommand(tokens[0], tokens[1])))
             {
-                COUT(1) << "Error: A command with name \"" << alias << "\" already exists." << std::endl;
+                orxout(user_error) << "A command with name \"" << alias << "\" already exists." << endl;
                 return;
             }
@@ -271,8 +300,8 @@
                 createConsoleCommand(tokens[0], tokens[1], executor);
             else
-                COUT(1) << "Error: \"" << alias << "\" is not a valid alias name (must have one or two words)." << std::endl;
+                orxout(user_error) << "\"" << alias << "\" is not a valid alias name (must have one or two words)." << endl;
         }
         else
-            COUT(1) << "Error: \"" << command << "\" is not a valid command (did you mean \"" << evaluation.getCommandSuggestion() << "\"?)." << std::endl;
+            orxout(user_error) << "\"" << command << "\" is not a valid command (did you mean \"" << evaluation.getCommandSuggestion() << "\"?)." << endl;
     }
 }
Index: code/trunk/src/libraries/core/command/CommandExecutor.h
===================================================================
--- code/trunk/src/libraries/core/command/CommandExecutor.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/CommandExecutor.h	(revision 8858)
@@ -111,5 +111,5 @@
 // tolua_end
         public:
-            static int execute(const std::string& command, bool useTcl = true); // tolua_export
+            static int execute(const std::string& command, bool useTcl = true, bool printErrors = true); // tolua_export
 
             static MultiType queryMT(const std::string& command, int* error = 0, bool useTcl = true);
@@ -119,8 +119,11 @@
 
             static const int Success = 0;       ///< Error code for "success" (or no error)
-            static const int Error = 1;         ///< Error code if the command doesn't exist
+            static const int Inexistent = 1;    ///< Error code if the command doesn't exist
             static const int Incomplete = 2;    ///< Error code if the command needs more arguments
             static const int Deactivated = 3;   ///< Error code if the command is not active
             static const int Denied = 4;        ///< Error code if the command needs a different access level
+            static const int Error = 5;         ///< Error code if the command returned an error
+
+            static std::string getErrorDescription(int error);
 
             static MultiType unhide(const std::string& command);
Index: code/trunk/src/libraries/core/command/ConsoleCommand.cc
===================================================================
--- code/trunk/src/libraries/core/command/ConsoleCommand.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/ConsoleCommand.cc	(revision 8858)
@@ -172,5 +172,5 @@
                 if (!this->executor_->defaultValueSet(i))
                 {
-                    COUT(2) << "Default value " << i << " is missing" << std::endl;
+                    orxout(internal_warning, context::commands) << "Default value " << i << " is missing" << endl;
                     return false;
                 }
@@ -202,5 +202,5 @@
                 if (!executor->defaultValueSet(i))
                 {
-                    COUT(2) << "Default value " << i << " is missing" << std::endl;
+                    orxout(internal_warning, context::commands) << "Default value " << i << " is missing" << endl;
                     return false;
                 }
@@ -229,5 +229,5 @@
         else
         {
-            COUT(1) << "Error: Couldn't assign new executor to console command \"" << this->baseName_ << "\", headers don't match." << std::endl;
+            orxout(internal_error, context::commands) << "Couldn't assign new executor to console command \"" << this->baseName_ << "\", headers don't match." << endl;
             return false;
         }
@@ -256,5 +256,5 @@
         else
         {
-            COUT(1) << "Error: Couldn't assign new functor to console command \"" << this->baseName_ << "\", headers don't match." << std::endl;
+            orxout(internal_error, context::commands) << "Couldn't assign new functor to console command \"" << this->baseName_ << "\", headers don't match." << endl;
             return false;
         }
@@ -307,5 +307,5 @@
             this->pushFunction(new Executor(*this->executor_.get()));
         else
-            COUT(1) << "Error: Couldn't push copy of executor in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Couldn't push copy of executor in console command \"" << this->baseName_ << "\", no executor set." << endl;
     }
 
@@ -367,8 +367,8 @@
             }
             else if (object)
-                COUT(1) << "Error: Can't assign object to console command \"" << this->baseName_ << "\", no functor set." << std::endl;
+                orxout(internal_error, context::commands) << "Can't assign object to console command \"" << this->baseName_ << "\", no functor set." << endl;
         }
         else if (object)
-            COUT(1) << "Error: Can't assign object to console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Can't assign object to console command \"" << this->baseName_ << "\", no executor set." << endl;
 
         return false;
@@ -418,5 +418,5 @@
             this->executor_->setDefaultValues(arg1);
         else
-            COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
 
         return *this;
@@ -431,5 +431,5 @@
             this->executor_->setDefaultValues(arg1, arg2);
         else
-            COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
 
         return *this;
@@ -444,5 +444,5 @@
             this->executor_->setDefaultValues(arg1, arg2, arg3);
         else
-            COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
 
         return *this;
@@ -457,5 +457,5 @@
             this->executor_->setDefaultValues(arg1, arg2, arg3, arg4);
         else
-            COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
 
         return *this;
@@ -470,5 +470,5 @@
             this->executor_->setDefaultValues(arg1, arg2, arg3, arg4, arg5);
         else
-            COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
 
         return *this;
@@ -485,5 +485,5 @@
             this->executor_->setDefaultValue(index, arg);
         else
-            COUT(1) << "Error: Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << std::endl;
+            orxout(internal_error, context::commands) << "Can't set default values in console command \"" << this->baseName_ << "\", no executor set." << endl;
 
         return *this;
@@ -500,5 +500,5 @@
             this->argumentCompleter_[index] = completer;
         else
-            COUT(2) << "Warning: Couldn't add autocompletion-function for index " << index << " in console command \"" << this->baseName_ << "\": index out of bound." << std::endl;
+            orxout(internal_warning, context::commands) << "Couldn't add autocompletion-function for index " << index << " in console command \"" << this->baseName_ << "\": index out of bound." << endl;
 
         return *this;
@@ -611,7 +611,7 @@
         {
             if (group == "")
-                COUT(1) << "Error: Couldn't find console command with shortcut \"" << name << "\"" << std::endl;
+                orxout(internal_error, context::commands) << "Couldn't find console command with shortcut \"" << name << "\"" << endl;
             else
-                COUT(1) << "Error: Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << std::endl;
+                orxout(internal_error, context::commands) << "Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << endl;
         }
         return 0;
@@ -644,7 +644,7 @@
         {
             if (group == "")
-                COUT(1) << "Error: Couldn't find console command with shortcut \"" << name << "\"" << std::endl;
+                orxout(internal_error, context::commands) << "Couldn't find console command with shortcut \"" << name << "\"" << endl;
             else
-                COUT(1) << "Error: Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << std::endl;
+                orxout(internal_error, context::commands) << "Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << endl;
         }
         return 0;
@@ -681,7 +681,7 @@
         {
             if (group == "")
-                COUT(2) << "Warning: A console command with shortcut \"" << name << "\" already exists." << std::endl;
+                orxout(internal_warning, context::commands) << "A console command with shortcut \"" << name << "\" already exists." << endl;
             else
-                COUT(2) << "Warning: A console command with name \"" << name << "\" already exists in group \"" << group << "\"." << std::endl;
+                orxout(internal_warning, context::commands) << "A console command with name \"" << name << "\" already exists in group \"" << group << "\"." << endl;
         }
         else
Index: code/trunk/src/libraries/core/command/ConsoleCommand.h
===================================================================
--- code/trunk/src/libraries/core/command/ConsoleCommand.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/ConsoleCommand.h	(revision 8858)
@@ -53,5 +53,5 @@
     void myCoutFunction(const std::string& text)        // Define a static function
     {
-        COUT(0) << "Text: " << text << std::endl;       // Print the text to the console
+        orxout() << "Text: " << text << endl;           // Print the text to the console
     }
 
@@ -125,5 +125,5 @@
     void myOtherCoutFunction(const std::string& text)                       // Define a new static function
     {
-        COUT(0) << "Uppercase: " << getUppercase(text) << std::endl;        // Print the text in uppercase to the console
+        orxout() << "Uppercase: " << getUppercase(text) << endl;            // Print the text in uppercase to the console
     }
 
Index: code/trunk/src/libraries/core/command/ConsoleCommandCompilation.cc
===================================================================
--- code/trunk/src/libraries/core/command/ConsoleCommandCompilation.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/ConsoleCommandCompilation.cc	(revision 8858)
@@ -38,5 +38,5 @@
 #include <string>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/ExprParser.h"
 #include "util/StringUtils.h"
@@ -46,8 +46,17 @@
 namespace orxonox
 {
+    SetConsoleCommand("echo", echo);
+
+    SetConsoleCommand("orxout", orxout_level);
+    SetConsoleCommand("orxout_context", orxout_level_context);
+
+    SetConsoleCommand("log"    , log    );
+    SetConsoleCommand("error"  , error  ).hide();
+    SetConsoleCommand("warning", warning).hide();
+    SetConsoleCommand("status" , status ).hide();
+    SetConsoleCommand("info"   , info   ).hide();
+    SetConsoleCommand("debug"  , debug  ).hide();
+
 //    SetConsoleCommand("source", source).argumentCompleter(0, autocompletion::files());  // disabled because we use the implementation in Tcl
-    SetConsoleCommand("echo", echo);
-//    SetConsoleCommand("puts", puts);                                                    // disabled because we use the implementation in Tcl
-
 //    SetConsoleCommand("read", read).argumentCompleter(0, autocompletion::files());      // disabled because we use the implementation in Tcl
 //    SetConsoleCommand("append", append).argumentCompleter(0, autocompletion::files());  // disabled because we use the implementation in Tcl
@@ -57,4 +66,99 @@
 
     /**
+        @brief Simply returns the arguments.
+    */
+    std::string echo(const std::string& text)
+    {
+        return text;
+    }
+
+    /**
+        @brief Builds a map that maps the levels of all output levels to their ID.
+    */
+    std::map<std::string, OutputLevel> getOutputLevelsMap()
+    {
+        std::map<std::string, OutputLevel> levels;
+
+        levels["message"]          = level::message;
+        levels["debug_output"]     = level::debug_output;
+        levels["user_error"]       = level::user_error;
+        levels["user_warning"]     = level::user_warning;
+        levels["user_status"]      = level::user_status;
+        levels["user_info"]        = level::user_info;
+        levels["internal_error"]   = level::internal_error;
+        levels["internal_warning"] = level::internal_warning;
+        levels["internal_status"]  = level::internal_status;
+        levels["internal_info"]    = level::internal_info;
+        levels["verbose"]          = level::verbose;
+        levels["verbose_more"]     = level::verbose_more;
+        levels["verbose_ultra"]    = level::verbose_ultra;
+
+        return levels;
+    }
+
+    /**
+        @brief Prints text to the console.
+        @param level_name The name of the output level
+    */
+    void orxout_level(const std::string& level_name, const std::string& text)
+    {
+        static std::map<std::string, OutputLevel> levels = getOutputLevelsMap();
+
+        OutputLevel level = level::debug_output;
+        std::map<std::string, OutputLevel>::iterator it = levels.find(level_name);
+        if (it != levels.end())
+            level = it->second;
+        else
+            orxout(internal_warning) << "'" << level_name << "' is not a valid output level" << endl;
+
+        orxout(level) << text << endl;
+    }
+
+    /**
+        @brief Prints text to the console.
+        @param level_name The name of the output level
+        @param context_name The name of the output context
+    */
+    void orxout_level_context(const std::string& level_name, const std::string& context_name, const std::string& text)
+    {
+        static std::map<std::string, OutputLevel> levels = getOutputLevelsMap();
+
+        OutputLevel level = level::debug_output;
+        std::map<std::string, OutputLevel>::iterator it = levels.find(level_name);
+        if (it != levels.end())
+            level = it->second;
+        else
+            orxout(internal_warning) << "'" << level_name << "' is not a valid output level" << endl;
+
+        OutputContextContainer context = registerContext(context_name);
+
+        orxout(level, context) << text << endl;
+    }
+
+    /// @brief Prints text to the console and the logfile.
+    void log(const std::string& text)
+    { orxout() << text << endl; }
+
+    /// @brief Prints output with error level.
+    void error(const std::string& text)
+    { orxout(user_error) << text << endl; }
+
+    /// @brief Prints output with warning level.
+    void warning(const std::string& text)
+    { orxout(user_warning) << text << endl; }
+
+    /// @brief Prints output with status level.
+    void status(const std::string& text)
+    { orxout(user_status) << text << endl; }
+
+    /// @brief Prints output with info level.
+    void info(const std::string& text)
+    { orxout(user_info) << text << endl; }
+
+    /// @brief Prints debug output with verbose level.
+    void debug(const std::string& text)
+    { orxout(verbose, context::tcl) << text << endl; }
+
+    /**
         @brief Reads the content of a file and executes the commands in it line by line.
     */
@@ -66,5 +170,5 @@
         if (it != executingFiles.end())
         {
-            COUT(1) << "Error: Recurring source command in \"" << filename << "\". Stopped execution." << std::endl;
+            orxout(user_error) << "Recurring source command in \"" << filename << "\". Stopped execution." << endl;
             return;
         }
@@ -76,5 +180,5 @@
         if (!file.is_open())
         {
-            COUT(1) << "Error: Couldn't open file \"" << filename << "\"." << std::endl;
+            orxout(user_error) << "Couldn't open file \"" << filename << "\"." << endl;
             return;
         }
@@ -95,27 +199,4 @@
 
     /**
-        @brief Simply returns the arguments.
-    */
-    std::string echo(const std::string& text)
-    {
-        return text;
-    }
-
-    /**
-        @brief Writes text to the console, depending on the first argument with or without a line-break after it.
-    */
-    void puts(bool newline, const std::string& text)
-    {
-        if (newline)
-        {
-            COUT(0) << stripEnclosingBraces(text) << std::endl;
-        }
-        else
-        {
-            COUT(0) << stripEnclosingBraces(text);
-        }
-    }
-
-    /**
         @brief Writes text to a file.
     */
@@ -127,9 +208,9 @@
         if (!file.is_open())
         {
-            COUT(1) << "Error: Couldn't write to file \"" << filename << "\"." << std::endl;
-            return;
-        }
-
-        file << text << std::endl;
+            orxout(user_error) << "Couldn't write to file \"" << filename << "\"." << endl;
+            return;
+        }
+
+        file << text << endl;
         file.close();
     }
@@ -145,9 +226,9 @@
         if (!file.is_open())
         {
-            COUT(1) << "Error: Couldn't append to file \"" << filename << "\"." << std::endl;
-            return;
-        }
-
-        file << text << std::endl;
+            orxout(user_error) << "Couldn't append to file \"" << filename << "\"." << endl;
+            return;
+        }
+
+        file << text << endl;
         file.close();
     }
@@ -163,5 +244,5 @@
         if (!file.is_open())
         {
-            COUT(1) << "Error: Couldn't read from file \"" << filename << "\"." << std::endl;
+            orxout(user_error) << "Couldn't read from file \"" << filename << "\"." << endl;
             return "";
         }
@@ -192,9 +273,9 @@
             if (expr.getResult() == 42.0)
             {
-                COUT(3) << "Greetings from the restaurant at the end of the universe." << std::endl;
+                orxout(user_info) << "Greetings from the restaurant at the end of the universe." << endl;
             }
             if (!expr.getRemains().empty())
             {
-                COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << std::endl;
+                orxout(user_warning) << "Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << endl;
             }
             return static_cast<float>(expr.getResult());
@@ -202,5 +283,5 @@
         else
         {
-            COUT(1) << "Error: Cannot calculate expression: Parse error." << std::endl;
+            orxout(user_error) << "Cannot calculate expression: Parse error." << endl;
             return 0;
         }
Index: code/trunk/src/libraries/core/command/ConsoleCommandCompilation.h
===================================================================
--- code/trunk/src/libraries/core/command/ConsoleCommandCompilation.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/ConsoleCommandCompilation.h	(revision 8858)
@@ -42,5 +42,14 @@
     _CoreExport void source(const std::string& filename);
     _CoreExport std::string echo(const std::string& text);
-    _CoreExport void puts(bool newline, const std::string& test);
+
+    _CoreExport void orxout_level(const std::string& level_name, const std::string& text);
+    _CoreExport void orxout_level_context(const std::string& level_name, const std::string& context_name, const std::string& text);
+
+    _CoreExport void log(const std::string& text);
+    _CoreExport void error(const std::string& text);
+    _CoreExport void warning(const std::string& text);
+    _CoreExport void status(const std::string& text);
+    _CoreExport void info(const std::string& text);
+    _CoreExport void debug(const std::string& text);
 
     _CoreExport void write(const std::string& filename, const std::string& text);
Index: code/trunk/src/libraries/core/command/Executor.cc
===================================================================
--- code/trunk/src/libraries/core/command/Executor.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/Executor.cc	(revision 8858)
@@ -38,5 +38,5 @@
 
 #include "util/Convert.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/StringUtils.h"
 #include "util/SubString.h"
@@ -104,9 +104,9 @@
         {
             if (bPrintError)
-                COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough arguments or default values given (input: " << arguments.join() << ")." << std::endl;
+                orxout(internal_warning) << "Can't call executor " << this->name_ << " through parser: Not enough arguments or default values given (input: " << arguments.join() << ")." << endl;
             return MT_Type::Null;
         }
 
-        COUT(5) << "Executor::parse: \"" << arguments.join(delimiter) << "\" -> " << argCount << " arguments: " << arg[0] << " / " << arg[1] << " / " << arg[2] << " / " << arg[3] << " / " << arg[4] << std::endl;
+        orxout(verbose, context::misc::executor) << "Executor::parse: \"" << arguments.join(delimiter) << "\" -> " << argCount << " arguments: " << arg[0] << " / " << arg[1] << " / " << arg[2] << " / " << arg[3] << " / " << arg[4] << endl;
 
         // execute the function with the evaluated arguments (the default values of the executor are also included in these arguments)
Index: code/trunk/src/libraries/core/command/Executor.h
===================================================================
--- code/trunk/src/libraries/core/command/Executor.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/Executor.h	(revision 8858)
@@ -57,5 +57,5 @@
     void myFunction(int a, int b)                           // declare a static function
     {
-        COUT(0) << "The sum is " << (a + b) << std::endl;   // print the sum of a and b to the console
+        orxout() << "The sum is " << (a + b) << endl;       // print the sum of a and b to the console
     }
 
Index: code/trunk/src/libraries/core/command/Functor.h
===================================================================
--- code/trunk/src/libraries/core/command/Functor.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/Functor.h	(revision 8858)
@@ -118,5 +118,5 @@
 #include <typeinfo>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/MultiType.h"
 #include "core/OrxonoxClass.h"
@@ -256,5 +256,5 @@
                 else
                 {
-                    COUT(1) << "Error: Can't execute FunctorMember, no object set." << std::endl;
+                    orxout(internal_error) << "Can't execute FunctorMember, no object set." << endl;
                     return MT_Type::Null;
                 }
@@ -339,5 +339,5 @@
             // see Functor::setRawObjectPointer()
             inline void setRawObjectPointer(void*)
-                { COUT(2) << "Warning: Can't assign an object pointer to a static functor" << std::endl; }
+                { orxout(internal_warning) << "Can't assign an object pointer to a static functor" << endl; }
             // see Functor::getRawObjectPointer()
             inline void* getRawObjectPointer() const
Index: code/trunk/src/libraries/core/command/IOConsolePOSIX.cc
===================================================================
--- code/trunk/src/libraries/core/command/IOConsolePOSIX.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/IOConsolePOSIX.cc	(revision 8858)
@@ -37,4 +37,5 @@
 #include "util/Clock.h"
 #include "util/Math.h"
+#include "util/output/ConsoleWriter.h"
 #include "core/Game.h"
 #include "core/input/InputBuffer.h"
@@ -55,5 +56,5 @@
 
     IOConsole::IOConsole()
-        : shell_(new Shell("IOConsole", false))
+        : shell_(new Shell("Console", false))
         , buffer_(shell_->getInputBuffer())
         , cout_(std::cout.rdbuf())
@@ -74,5 +75,5 @@
 
         // Disable standard std::cout logging
-        OutputHandler::getInstance().disableCout();
+        ConsoleWriter::getInstance().disable();
         // Redirect std::cout to an ostringstream
         // (Other part is in the initialiser list)
@@ -88,5 +89,5 @@
         std::cout.flush();
         if (!this->origCout_.str().empty())
-            this->shell_->addOutput(this->origCout_.str(), Shell::None);
+            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
         // Erase input and status lines
         this->cout_ << "\033[1G\033[J";
@@ -102,5 +103,5 @@
         std::cout.rdbuf(this->cout_.rdbuf());
         // Enable standard std::cout logging again
-        OutputHandler::getInstance().enableCout();
+        ConsoleWriter::getInstance().enable();
     }
 
@@ -229,5 +230,5 @@
         if (!this->origCout_.str().empty())
         {
-            this->shell_->addOutput(this->origCout_.str(), Shell::None);
+            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
             this->origCout_.str("");
         }
@@ -239,14 +240,25 @@
         switch (type)
         {
-        case Shell::Error:   this->cout_ << "\033[91m"; break;
-        case Shell::Warning: this->cout_ << "\033[93m"; break;
-        case Shell::Info:    this->cout_ << "\033[90m"; break;
-        case Shell::Debug:   this->cout_ << "\033[90m"; break;
-        case Shell::Verbose: this->cout_ << "\033[90m"; break;
-        case Shell::Ultra:   this->cout_ << "\033[90m"; break;
-        case Shell::Command: this->cout_ << "\033[36m"; break;
-        case Shell::Hint:    this->cout_ << "\033[33m"; break;
-        case Shell::TDebug:  this->cout_ << "\033[95m"; break;
-        default: break;
+            case Shell::Message:
+            case Shell::DebugOutput:     this->cout_ << "\033[0m"; break;
+
+            case Shell::UserError:       this->cout_ << "\033[91m"; break;
+            case Shell::UserWarning:     this->cout_ << "\033[93m"; break;
+            case Shell::UserStatus:      this->cout_ << "\033[92m"; break;
+            case Shell::UserInfo:        this->cout_ << "\033[96m"; break;
+
+            case Shell::InternalError:   this->cout_ << "\033[31m"; break;
+            case Shell::InternalWarning: this->cout_ << "\033[33m"; break;
+            case Shell::InternalStatus:  this->cout_ << "\033[32m"; break;
+            case Shell::InternalInfo:    this->cout_ << "\033[36m"; break;
+
+            case Shell::Verbose:         this->cout_ << "\033[94m"; break;
+            case Shell::VerboseMore:     this->cout_ << "\033[34m"; break;
+            case Shell::VerboseUltra:    this->cout_ << "\033[34m"; break;
+
+            case Shell::Command:         this->cout_ << "\033[95m"; break;
+            case Shell::Hint:            this->cout_ << "\033[35m"; break;
+
+            default:                     this->cout_ << "\033[37m"; break;
         }
 
@@ -371,5 +383,5 @@
     void IOConsole::executed()
     {
-        this->shell_->addOutput(this->promptString_ + this->shell_->getInput() + '\n', Shell::Command);
+        this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command);
     }
 
@@ -378,18 +390,4 @@
     {
         // Exit is not an option, just do nothing (Shell doesn't really exit too)
-    }
-
-    //! Called if only the last output-line has changed
-    void IOConsole::onlyLastLineChanged()
-    {
-        // Save cursor position and move it to the beginning of the first output line
-        this->cout_ << "\033[s\033[1A\033[1G";
-        // Erase the line
-        this->cout_ << "\033[K";
-        // Reprint the last output line
-        this->printOutputLine(this->shell_->getNewestLineIterator()->first, this->shell_->getNewestLineIterator()->second);
-        // Restore cursor
-        this->cout_ << "\033[u";
-        this->cout_.flush();
     }
 
Index: code/trunk/src/libraries/core/command/IOConsolePOSIX.h
===================================================================
--- code/trunk/src/libraries/core/command/IOConsolePOSIX.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/IOConsolePOSIX.h	(revision 8858)
@@ -66,5 +66,4 @@
         // Methods from ShellListener
         void linesChanged();
-        void onlyLastLineChanged();
         void lineAdded();
         void inputChanged();
Index: code/trunk/src/libraries/core/command/IOConsoleWindows.cc
===================================================================
--- code/trunk/src/libraries/core/command/IOConsoleWindows.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/IOConsoleWindows.cc	(revision 8858)
@@ -34,4 +34,5 @@
 #include "util/Clock.h"
 #include "util/Math.h"
+#include "util/output/ConsoleWriter.h"
 #include "core/Game.h"
 #include "core/input/InputBuffer.h"
@@ -43,5 +44,5 @@
     //! Redirects std::cout, creates the corresponding Shell and changes the terminal mode
     IOConsole::IOConsole()
-        : shell_(new Shell("IOConsole", false))
+        : shell_(new Shell("Console", false))
         , buffer_(shell_->getInputBuffer())
         , cout_(std::cout.rdbuf())
@@ -52,5 +53,5 @@
     {
         // Disable standard this->cout_ logging
-        OutputHandler::getInstance().disableCout();
+        ConsoleWriter::getInstance().disable();
         // Redirect std::cout to an ostringstream
         // (Other part is in the initialiser list)
@@ -95,5 +96,5 @@
         std::cout.flush();
         if (!this->origCout_.str().empty())
-            this->shell_->addOutput(this->origCout_.str(), Shell::None);
+            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
 
         this->shell_->unregisterListener(this);
@@ -108,5 +109,5 @@
         std::cout.rdbuf(this->cout_.rdbuf());
         // Enable standard this->cout_ logging again
-        OutputHandler::getInstance().enableCout();
+        ConsoleWriter::getInstance().enable();
 
         resetTerminalMode();
@@ -188,5 +189,5 @@
         if (!this->origCout_.str().empty())
         {
-            this->shell_->addOutput(this->origCout_.str(), Shell::None);
+            this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
             this->origCout_.str("");
         }
@@ -200,14 +201,25 @@
         switch (type)
         {
-        case Shell::Error:   colour = FOREGROUND_INTENSITY                    | FOREGROUND_RED; break;
-        case Shell::Warning: colour = FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED; break;
-        case Shell::Info:
-        case Shell::Debug:
-        case Shell::Verbose:
-        case Shell::Ultra:   colour = FOREGROUND_INTENSITY                                     ; break;
-        case Shell::Command: colour =                        FOREGROUND_GREEN                  | FOREGROUND_BLUE; break;
-        case Shell::Hint:    colour =                        FOREGROUND_GREEN | FOREGROUND_RED                  ; break;
-        case Shell::TDebug:  colour = FOREGROUND_INTENSITY                    | FOREGROUND_RED | FOREGROUND_BLUE; break;
-        default:             colour =                        FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE; break;
+            case Shell::Message:
+            case Shell::DebugOutput:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
+
+            case Shell::UserError:       colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | 0              ; break;
+            case Shell::UserWarning:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
+            case Shell::UserStatus:      colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | 0              ; break;
+            case Shell::UserInfo:        colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
+
+            case Shell::InternalError:   colour = 0                    | FOREGROUND_RED | 0                | 0              ; break;
+            case Shell::InternalWarning: colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
+            case Shell::InternalStatus:  colour = 0                    | 0              | FOREGROUND_GREEN | 0              ; break;
+            case Shell::InternalInfo:    colour = 0                    | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
+
+            case Shell::Verbose:         colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
+            case Shell::VerboseMore:     colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
+            case Shell::VerboseUltra:    colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
+
+            case Shell::Command:         colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
+            case Shell::Hint:            colour = 0                    | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
+
+            default:                     colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
         }
 
@@ -238,5 +250,5 @@
             || !SetConsoleMode(this->stdInHandle_, 0))
         {
-            COUT(1) << "Error: Could not set Windows console settings" << std::endl;
+            orxout(user_error) << "Could not set Windows console settings" << endl;
             return;
         }
@@ -318,5 +330,5 @@
     void IOConsole::executed()
     {
-        this->shell_->addOutput(this->promptString_ + this->shell_->getInput() + '\n', Shell::Command);
+        this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command);
     }
 
@@ -377,18 +389,4 @@
     }
 
-    //! Called if only the last output-line has changed
-    void IOConsole::onlyLastLineChanged()
-    {
-        int newLineHeight = 1 + this->shell_->getNewestLineIterator()->first.size() / this->terminalWidth_;
-        // Compute the number of new lines needed
-        int newLines = newLineHeight - this->lastOutputLineHeight_;
-        this->lastOutputLineHeight_ = newLineHeight;
-        // Scroll console if necessary
-        if (newLines > 0) // newLines < 0 is assumed impossible
-            this->createNewOutputLines(newLines);
-        Shell::LineList::const_iterator it = this->shell_->getNewestLineIterator();
-        this->printOutputLine(it->first, it->second, makeCOORD(0, this->inputLineRow_ - newLineHeight));
-    }
-
     //! Called if a new output line was added
     void IOConsole::lineAdded()
Index: code/trunk/src/libraries/core/command/IOConsoleWindows.h
===================================================================
--- code/trunk/src/libraries/core/command/IOConsoleWindows.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/IOConsoleWindows.h	(revision 8858)
@@ -68,5 +68,4 @@
         // Methods from ShellListener
         void linesChanged();
-        void onlyLastLineChanged();
         void lineAdded();
         void inputChanged();
Index: code/trunk/src/libraries/core/command/IRC.cc
===================================================================
--- code/trunk/src/libraries/core/command/IRC.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/IRC.cc	(revision 8858)
@@ -85,5 +85,5 @@
         }
         catch (Tcl::tcl_error const &e)
-        {   COUT(1) << "Tcl (IRC) error: " << e.what();   }
+        {   orxout(user_error, context::tcl) << "Tcl (IRC) error: " << e.what() << endl;   }
 
         this->nickname_ = "orx" + multi_cast<std::string>(static_cast<unsigned int>(rand()));
@@ -100,5 +100,5 @@
         {
             IRC::getInstance().initialize();
-            COUT(1) << "Error: IRC client wasn't yet initialized, please try again." << std::endl;
+            orxout(user_error) << "IRC client wasn't yet initialized, please try again." << endl;
             return false;
         }
@@ -110,5 +110,5 @@
         }
         catch (Tcl::tcl_error const &e)
-        {   COUT(1) << "Tcl (IRC) error: " << e.what();   }
+        {   orxout(user_error, context::tcl) << "Tcl (IRC) error: " << e.what() << endl;   }
 
         return false;
@@ -139,5 +139,5 @@
     void IRC::tcl_say(Tcl::object const &channel, Tcl::object const &nick, Tcl::object const &args)
     {
-        COUT(0) << "IRC> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << std::endl;
+        orxout(message) << "IRC> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << endl;
     }
 
@@ -145,5 +145,5 @@
     void IRC::tcl_privmsg(Tcl::object const &query, Tcl::object const &nick, Tcl::object const &args)
     {
-        COUT(0) << "IRC (" << query.get() << ")> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << std::endl;
+        orxout(message) << "IRC (" << query.get() << ")> " << nick.get() << ": " << stripEnclosingBraces(args.get()) << endl;
     }
 
@@ -151,5 +151,5 @@
     void IRC::tcl_action(Tcl::object const &channel, Tcl::object const &nick, Tcl::object const &args)
     {
-        COUT(0) << "IRC> * " << nick.get() << ' ' << stripEnclosingBraces(args.get()) << std::endl;
+        orxout(message) << "IRC> * " << nick.get() << ' ' << stripEnclosingBraces(args.get()) << endl;
     }
 
@@ -157,5 +157,5 @@
     void IRC::tcl_info(Tcl::object const &channel, Tcl::object const &args)
     {
-        COUT(0) << "IRC> --> " << stripEnclosingBraces(args.get()) << std::endl;
+        orxout(message) << "IRC> --> " << stripEnclosingBraces(args.get()) << endl;
     }
 }
Index: code/trunk/src/libraries/core/command/Shell.cc
===================================================================
--- code/trunk/src/libraries/core/command/Shell.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/Shell.cc	(revision 8858)
@@ -35,7 +35,8 @@
 
 #include "util/Math.h"
-#include "util/OutputHandler.h"
 #include "util/StringUtils.h"
 #include "util/SubString.h"
+#include "util/output/OutputManager.h"
+#include "util/output/MemoryWriter.h"
 #include "core/CoreIncludes.h"
 #include "core/ConfigFileManager.h"
@@ -44,28 +45,28 @@
 #include "core/input/InputBuffer.h"
 #include "CommandExecutor.h"
-#include "ConsoleCommand.h"
 
 namespace orxonox
 {
-    SetConsoleCommand("log",     OutputHandler::log    );
-    SetConsoleCommand("error",   OutputHandler::error  ).hide();
-    SetConsoleCommand("warning", OutputHandler::warning).hide();
-    SetConsoleCommand("info",    OutputHandler::info   ).hide();
-    SetConsoleCommand("debug",   OutputHandler::debug  ).hide();
-
     unsigned int Shell::cacheSize_s;
 
-    /**
-        @brief Constructor: Initializes the values and registers itself at OutputHandler.
+    namespace DefaultLogLevel
+    {
+        const OutputLevel Dev  = level::internal_warning;
+        const OutputLevel User = level::user_info;
+    }
+
+    /**
+        @brief Constructor: Initializes the values.
         @param consoleName The name of the shell - used to define the name of the soft-debug-level config-value
         @param bScrollable If true, the user is allowed to scroll through the output-lines
     */
     Shell::Shell(const std::string& consoleName, bool bScrollable)
-        : OutputListener(consoleName)
+        : BaseWriter(consoleName, false)
         , inputBuffer_(new InputBuffer())
-        , consoleName_(consoleName)
         , bScrollable_(bScrollable)
     {
         RegisterRootObject(Shell);
+
+        OutputManager::getInstance().registerListener(this);
 
         this->scrollPosition_ = 0;
@@ -73,5 +74,4 @@
         this->historyPosition_ = 0;
         this->historyOffset_ = 0;
-        this->bFinishedLastLine_ = true;
 
         this->clearOutput();
@@ -81,38 +81,22 @@
         ConfigFileManager::getInstance().setFilename(ConfigFileType::CommandHistory, "commandHistory.ini");
 
-        // Use a stringstream object to buffer the output
-        this->outputStream_ = &this->outputBuffer_;
+        // Choose the default level according to the path Orxonox was started (build directory or not)
+        OutputLevel defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User);
+        this->setLevelMax(defaultDebugLevel);
 
         this->setConfigValues();
 
         // Get the previous output and add it to the Shell
-        OutputHandler::OutputVector::const_iterator it = OutputHandler::getInstance().getOutput().begin();
-        for (;it != OutputHandler::getInstance().getOutput().end(); ++it)
-        {
-            if (it->first <= debugLevel_)
-            {
-                this->outputBuffer_ << it->second;
-                this->outputChanged(it->first);
-            }
-        }
-
-        // Register the shell as output listener
-        OutputHandler::getInstance().registerOutputListener(this);
-        OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
-    }
-
-    /**
-        @brief Destructor: Unregisters the shell from OutputHandler.
+        MemoryWriter::getInstance().resendOutput(this);
+    }
+
+    /**
+        @brief Destructor
     */
     Shell::~Shell()
     {
-        OutputHandler::getInstance().unregisterOutputListener(this);
         this->inputBuffer_->destroy();
-    }
-
-    namespace DefaultLogLevel
-    {
-        const OutputLevel::Value Dev  = OutputLevel::Info;
-        const OutputLevel::Value User = OutputLevel::Error;
+
+        OutputManager::getInstance().unregisterListener(this);
     }
 
@@ -129,9 +113,22 @@
         SetConfigValue(cacheSize_s, 32);
 
-        // Choose the default level according to the path Orxonox was started (build directory or not)
-        OutputLevel::Value defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User);
-        SetConfigValueExternal(debugLevel_, "OutputHandler", "debugLevel" + consoleName_, defaultDebugLevel)
-            .description("The maximum level of debug output shown in the " + consoleName_);
-        OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
+        SetConfigValueExternal(this->configurableMaxLevel_,
+                               this->getConfigurableSectionName(),
+                               this->getConfigurableMaxLevelName(),
+                               this->configurableMaxLevel_)
+            .description("The maximum level of output shown in the " + this->getName())
+            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableLevel);
+        SetConfigValueExternal(this->configurableAdditionalContextsMaxLevel_,
+                               this->getConfigurableSectionName(),
+                               this->getConfigurableAdditionalContextsMaxLevelName(),
+                               this->configurableAdditionalContextsMaxLevel_)
+            .description("The maximum level of output shown in the " + this->getName() + " for additional contexts")
+            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableAdditionalContextsLevel);
+        SetConfigValueExternal(this->configurableAdditionalContexts_,
+                               this->getConfigurableSectionName(),
+                               this->getConfigurableAdditionalContextsName(),
+                               this->configurableAdditionalContexts_)
+            .description("Additional output contexts shown in the " + this->getName())
+            .callback(static_cast<BaseWriter*>(this), &BaseWriter::changedConfigurableAdditionalContexts);
     }
 
@@ -168,10 +165,10 @@
         if (isNormal)
         {
-            ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, update);
+            ModifyConfigValueExternal(this->configurableMaxLevel_, this->getConfigurableMaxLevelName(), update);
         }
         else
         {
-            OutputLevel::Value level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
-            ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, tset, level);
+            OutputLevel level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
+            ModifyConfigValueExternal(this->configurableMaxLevel_, this->getConfigurableMaxLevelName(), tset, level);
         }
     }
@@ -252,10 +249,31 @@
 
     /**
-        @brief Sends output to the internal output buffer.
+        @brief Adds multiple lines to the internal output buffer.
     */
     void Shell::addOutput(const std::string& text, LineType type)
     {
-        this->outputBuffer_ << text;
-        this->outputChanged(type);
+        std::vector<std::string> lines;
+        vectorize(text, '\n', &lines);
+
+        for (size_t i = 0; i < lines.size(); ++i)
+            this->addLine(lines[i], type);
+    }
+
+    /**
+        @brief Adds a line to the internal output buffer.
+    */
+    void Shell::addLine(const std::string& line, LineType type)
+    {
+        // yes it was - push the new line to the list
+        this->outputLines_.push_front(std::make_pair(line, static_cast<LineType>(type)));
+
+        // adjust the scroll position if needed
+        if (this->scrollPosition_)
+            this->scrollPosition_++;
+        else
+            this->scrollIterator_ = this->outputLines_.begin();
+
+        if (!this->scrollPosition_)
+            this->updateListeners<&ShellListener::lineAdded>();
     }
 
@@ -269,7 +287,14 @@
 
         this->scrollPosition_ = 0;
-        this->bFinishedLastLine_ = true;
 
         this->updateListeners<&ShellListener::linesChanged>();
+    }
+
+    /**
+        @brief Inherited from BaseWriter (LogListener), called if a new line of output was sent.
+    */
+    void Shell::printLine(const std::string& line, OutputLevel level)
+    {
+        this->addLine(line, static_cast<LineType>(level));
     }
 
@@ -323,59 +348,4 @@
 
     /**
-        @brief Called by OutputHandler or internally whenever output was sent to the output buffer. Reads from the buffer and writes the new output-lines to the list.
-    */
-    void Shell::outputChanged(int lineType)
-    {
-        bool newline = false;
-        do
-        {
-            // get the first line from the buffer
-            std::string output;
-            std::getline(this->outputBuffer_, output);
-
-            // check the state of the buffer
-            bool eof = this->outputBuffer_.eof();
-            bool fail = this->outputBuffer_.fail();
-            if (eof)
-                this->outputBuffer_.flush(); // check if more output was received in the meantime
-            if (eof || fail)
-                this->outputBuffer_.clear(); // clear the error flags
-
-            // the line is terminated with a line-break if neither an error occurred nor the end of the file was reached
-            newline = (!eof && !fail);
-
-            // no output retrieved - break the loop
-            if (!newline && output.empty())
-                break;
-
-            // check if the last line was terminated with a line-break
-            if (this->bFinishedLastLine_)
-            {
-                // yes it was - push the new line to the list
-                this->outputLines_.push_front(std::make_pair(output, static_cast<LineType>(lineType)));
-
-                // adjust the scroll position if needed
-                if (this->scrollPosition_)
-                    this->scrollPosition_++;
-                else
-                    this->scrollIterator_ = this->outputLines_.begin();
-
-                if (!this->scrollPosition_)
-                    this->updateListeners<&ShellListener::lineAdded>();
-            }
-            else
-            {
-                // no it wasn't - add the new output to the last line
-                this->outputLines_.front().first += output;
-                this->updateListeners<&ShellListener::onlyLastLineChanged>();
-            }
-
-            // remember if the last line was terminated with a line-break
-            this->bFinishedLastLine_ = newline;
-
-        } while (newline); // loop as long as more lines are in the buffer
-    }
-
-    /**
         @brief Clears the text in the input buffer.
     */
@@ -409,19 +379,7 @@
         const std::string& result = CommandExecutor::query(this->inputBuffer_->get(), &error);
         if (error)
-        {
-            switch (error)
-            {
-                case CommandExecutor::Error:       this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", command doesn't exist. (S)" << std::endl; break;
-                case CommandExecutor::Incomplete:  this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", not enough arguments given. (S)" << std::endl; break;
-                case CommandExecutor::Deactivated: this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", command is not active. (S)" << std::endl; break;
-                case CommandExecutor::Denied:      this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", access denied. (S)" << std::endl; break;
-            }
-            this->outputChanged(Error);
-        }
+            this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", UserError);
         else if (result != "")
-        {
-            this->outputBuffer_ << result << std::endl;
-            this->outputChanged(Command);
-        }
+            this->addOutput(result, Result);
 
         this->clearInput();
@@ -432,6 +390,5 @@
     {
         this->inputBuffer_->set(CommandExecutor::evaluate(this->inputBuffer_->get()).complete());
-        this->outputBuffer_ << CommandExecutor::evaluate(this->inputBuffer_->get()).hint() << std::endl;
-        this->outputChanged(Hint);
+        this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), Hint);
 
         this->inputChanged();
Index: code/trunk/src/libraries/core/command/Shell.h
===================================================================
--- code/trunk/src/libraries/core/command/Shell.h	(revision 8857)
+++ code/trunk/src/libraries/core/command/Shell.h	(revision 8858)
@@ -48,5 +48,5 @@
 #include <vector>
 
-#include "util/OutputHandler.h"
+#include "util/output/BaseWriter.h"
 #include "core/Core.h"
 #include "core/OrxonoxClass.h"
@@ -66,5 +66,4 @@
         private:
             virtual void linesChanged() {}          ///< Called if all output-lines have changed
-            virtual void onlyLastLineChanged() {}   ///< Called if only the last output-line has changed
             virtual void lineAdded() {}             ///< Called if a new line was added to the output
             virtual void inputChanged() {}          ///< Called if the input has changed
@@ -78,5 +77,5 @@
         @brief The Shell is the logical component of the console that displays output to the user and allows him to enter commands.
 
-        The Shell gathers output sent from OutputHandler by inheriting from OutputListener.
+        The Shell gathers output sent from OutputManager by inheriting from BaseWriter.
         The output-lines are stored in the shell, so they can be displayed in a graphical
         console. Additionally the Shell has an InputBuffer which is needed by the user to
@@ -85,5 +84,5 @@
         Different graphical consoles build upon a Shell, for example InGameConsole and IOConsole.
     */
-    class _CoreExport Shell : public OutputListener, public DevModeListener
+    class _CoreExport Shell : public BaseWriter, public DevModeListener
     {
         public:
@@ -91,14 +90,21 @@
             enum LineType
             {
-                TDebug  = OutputLevel::TDebug,
-                None    = OutputLevel::None,
-                Warning = OutputLevel::Warning,
-                Error   = OutputLevel::Error,
-                Info    = OutputLevel::Info,
-                Debug   = OutputLevel::Debug,
-                Verbose = OutputLevel::Verbose,
-                Ultra   = OutputLevel::Ultra,
+                DebugOutput     = debug_output,
+                Message         = message,
+                UserError       = user_error,
+                UserWarning     = user_warning,
+                UserStatus      = user_status,
+                UserInfo        = user_info,
+                InternalError   = internal_error,
+                InternalWarning = internal_warning,
+                InternalStatus  = internal_status,
+                InternalInfo    = internal_info,
+                Verbose         = verbose,
+                VerboseMore     = verbose_more,
+                VerboseUltra    = verbose_ultra,
+                Cout,
                 Input,
                 Command,
+                Result,
                 Hint
             };
@@ -127,5 +133,6 @@
             LineList::const_iterator getEndIterator() const;
 
-            void addOutput(const std::string& text, LineType type = None);
+            void addOutput(const std::string& text, LineType type = DebugOutput);
+            void addLine(const std::string& line, LineType type = DebugOutput);
             void clearOutput();
 
@@ -150,6 +157,6 @@
             const std::string& getFromHistory() const;
             void clearInput();
-            // OutputListener
-            void outputChanged(int level);
+            // BaseWriter
+            virtual void printLine(const std::string& line, OutputLevel level);
 
             void configureInputBuffer();
@@ -183,12 +190,8 @@
             std::list<ShellListener*> listeners_;           ///< The registered shell listeners
             InputBuffer*              inputBuffer_;         ///< The input buffer that is needed by the user to enter text
-            std::stringstream         outputBuffer_;        ///< The output buffer that is used to retrieve lines of output from OutputListener
-            bool                      bFinishedLastLine_;   ///< Stores if the most recent output-line was terminated with a line-break or if more output is expected for this line
             LineList                  outputLines_;         ///< A list of all output-lines that were displayed in the shell so far
             LineList::const_iterator  scrollIterator_;      ///< An iterator to an entry of the list of output-lines, changes if the user scrolls through the output in the shell
             unsigned int              scrollPosition_;      ///< The number of the line that is currently being referenced by scrollIterator_
             unsigned int              historyPosition_;     ///< If the user scrolls through the history of entered commands (stored in commandHistory_), this contains the currently viewed history entry
-
-            const std::string         consoleName_;         ///< The name of this shell - used to define the name of the soft-debug-level config-value
             const bool                bScrollable_;         ///< If true, the user can scroll through the output-lines
 
@@ -197,5 +200,4 @@
             unsigned int              historyOffset_;       ///< The command history is a circular buffer, this variable defines the current write-offset
             std::vector<std::string>  commandHistory_;      ///< The history of commands that were entered by the user
-            int                       debugLevel_;          //!< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
             static unsigned int       cacheSize_s;          ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is no OrxonoxClass
     };
Index: code/trunk/src/libraries/core/command/TclBind.cc
===================================================================
--- code/trunk/src/libraries/core/command/TclBind.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/TclBind.cc	(revision 8858)
@@ -34,5 +34,5 @@
 
 #include "SpecialConfig.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "util/StringUtils.h"
@@ -106,5 +106,5 @@
             }
             catch (Tcl::tcl_error const &e)
-            {   COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl;   }
+            {   orxout(internal_error, context::tcl) << "Tcl error while creating Tcl-interpreter: " << e.what() << endl;   }
         }
     }
@@ -129,5 +129,8 @@
         }
         catch (Tcl::tcl_error const &e)
-        {   COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl; COUT(1) << "Error: Tcl isn't properly initialized. Orxonox might possibly not work like that." << std::endl;   }
+        {
+            orxout(internal_error, context::tcl) << "Tcl error while creating Tcl-interpreter: " << e.what() << endl;
+            orxout(user_error, context::tcl) << "Tcl isn't properly initialized. Orxonox might possibly not work like that." << endl;
+        }
 
         return interpreter;
@@ -154,5 +157,5 @@
     std::string TclBind::tcl_query(Tcl::object const &args)
     {
-        COUT(4) << "Tcl_query: " << args.get() << std::endl;
+        orxout(verbose, context::commands) << "Tcl_query: " << args.get() << endl;
         return TclBind::tcl_helper(args, true);
     }
@@ -163,5 +166,5 @@
     void TclBind::tcl_execute(Tcl::object const &args)
     {
-        COUT(4) << "Tcl_execute: " << args.get() << std::endl;
+        orxout(verbose, context::commands) << "Tcl_execute: " << args.get() << endl;
         TclBind::tcl_helper(args, false);
     }
@@ -184,14 +187,10 @@
             error = evaluation.execute();
 
-        switch (error)
-        {
-            case CommandExecutor::Error:       COUT(1) << "Error: Can't execute command \"" << command << "\", command doesn't exist. (B)" << std::endl; break;
-            case CommandExecutor::Incomplete:  COUT(1) << "Error: Can't execute command \"" << command << "\", not enough arguments given. (B)" << std::endl; break;
-            case CommandExecutor::Deactivated: COUT(1) << "Error: Can't execute command \"" << command << "\", command is not active. (B)" << std::endl; break;
-            case CommandExecutor::Denied:      COUT(1) << "Error: Can't execute command \"" << command << "\", access denied. (B)" << std::endl; break;
-        }
-
-        if (error == CommandExecutor::Error)
-            COUT(3) << "Did you mean \"" << evaluation.getCommandSuggestion() << "\"?" << std::endl;
+        if (error)
+        {
+            orxout(user_error) << "Can't execute command \"" << command << "\", " + CommandExecutor::getErrorDescription(error) + ". (TclBind)" << endl;
+            if (error == CommandExecutor::Inexistent)
+                orxout(user_info) << "Did you mean \"" << evaluation.getCommandSuggestion() << "\"?" << endl;
+        }
 
         return result;
@@ -211,5 +210,5 @@
             }
             catch (Tcl::tcl_error const &e)
-            {   COUT(1) << "Tcl error: " << e.what() << std::endl;   }
+            {   orxout(user_error, context::tcl) << "Tcl error: " << e.what() << endl;   }
         }
 
@@ -223,5 +222,5 @@
     void TclBind::bgerror(const std::string& error)
     {
-        COUT(1) << "Tcl background error: " << stripEnclosingBraces(error) << std::endl;
+        orxout(user_error, context::tcl) << "Tcl background error: " << stripEnclosingBraces(error) << endl;
     }
 
@@ -243,5 +242,5 @@
         }
         catch (Tcl::tcl_error const &e)
-        {   COUT(1) << "Tcl error: " << e.what() << std::endl;   }
+        {   orxout(user_error, context::tcl) << "Tcl error: " << e.what() << endl;   }
 
         if (error)
Index: code/trunk/src/libraries/core/command/TclThreadManager.cc
===================================================================
--- code/trunk/src/libraries/core/command/TclThreadManager.cc	(revision 8857)
+++ code/trunk/src/libraries/core/command/TclThreadManager.cc	(revision 8858)
@@ -225,5 +225,5 @@
         TclThreadManager::getInstance().numInterpreterBundles_++;
         TclThreadManager::createWithId(TclThreadManager::getInstance().numInterpreterBundles_);
-        COUT(0) << "Created new Tcl-interpreter with ID " << TclThreadManager::getInstance().numInterpreterBundles_ << std::endl;
+        orxout(user_info) << "Created new Tcl-interpreter with ID " << TclThreadManager::getInstance().numInterpreterBundles_ << endl;
         return TclThreadManager::getInstance().numInterpreterBundles_;
     }
@@ -288,5 +288,8 @@
         }
         catch (const Tcl::tcl_error& e)
-        {   bundle->interpreter_ = 0; COUT(1) << "Tcl error while creating Tcl-interpreter (" << id_string << "): " << e.what() << std::endl;   }
+        {
+            bundle->interpreter_ = 0;
+            orxout(user_error, context::tcl) << "Tcl error while creating Tcl-interpreter (" << id_string << "): " << e.what() << endl;
+        }
     }
 
@@ -407,5 +410,5 @@
             {
                 // This query would lead to a deadlock - return with an error
-                TclThreadManager::error("Error: Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + multi_cast<std::string>(source_bundle->id_) \
+                TclThreadManager::error("Circular query (" + this->dumpList(source_bundle->queriers_.getList()) + ' ' + multi_cast<std::string>(source_bundle->id_) \
                             + " -> " + multi_cast<std::string>(target_bundle->id_) \
                             + "), couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target_bundle->id_) \
@@ -446,11 +449,6 @@
                         int error;
                         output = CommandExecutor::query(command, &error, false);
-                        switch (error)
-                        {
-                            case CommandExecutor::Error:       TclThreadManager::error("Error: Can't execute command \"" + command + "\", command doesn't exist. (T)"); break;
-                            case CommandExecutor::Incomplete:  TclThreadManager::error("Error: Can't execute command \"" + command + "\", not enough arguments given. (T)"); break;
-                            case CommandExecutor::Deactivated: TclThreadManager::error("Error: Can't execute command \"" + command + "\", command is not active. (T)"); break;
-                            case CommandExecutor::Denied:      TclThreadManager::error("Error: Can't execute command \"" + command + "\", access denied. (T)"); break;
-                        }
+                        if (error)
+                            TclThreadManager::error("Can't execute command \"" + command + "\", " + CommandExecutor::getErrorDescription(error) + ". (TclThreadManager)");
                     }
                     else
@@ -476,5 +474,5 @@
                     // This happens if the main thread tries to query a busy interpreter
                     // To avoid a lock of the main thread, we simply don't proceed with the query in this case
-                    TclThreadManager::error("Error: Couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target_bundle->id_) + ", interpreter is busy right now.");
+                    TclThreadManager::error("Couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target_bundle->id_) + ", interpreter is busy right now.");
                 }
             }
@@ -522,5 +520,5 @@
         else
         {
-            TclThreadManager::error("Error: No Tcl-interpreter with ID " + multi_cast<std::string>(id) + " existing.");
+            TclThreadManager::error("No Tcl-interpreter with ID " + multi_cast<std::string>(id) + " existing.");
             return 0;
         }
Index: code/trunk/src/libraries/core/input/Button.cc
===================================================================
--- code/trunk/src/libraries/core/input/Button.cc	(revision 8857)
+++ code/trunk/src/libraries/core/input/Button.cc	(revision 8858)
@@ -38,5 +38,5 @@
 #include "util/SubString.h"
 #include "util/StringUtils.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "core/command/ConsoleCommand.h"
 #include "core/command/CommandEvaluation.h"
@@ -255,11 +255,11 @@
         if (serious)
         {
-            COUT(2) << "Error while parsing binding for button/axis " << this->name_ << ". "
-                << message << std::endl;
+            orxout(internal_error, context::input) << "Error while parsing binding for button/axis " << this->name_ << ". "
+                << message << endl;
         }
         else
         {
-            COUT(3) << "Warning while parsing binding for button/axis " << this->name_ << ". "
-                << message << std::endl;
+            orxout(internal_warning, context::input) << "Warning while parsing binding for button/axis " << this->name_ << ". "
+                << message << endl;
         }
     }
Index: code/trunk/src/libraries/core/input/InputDevice.h
===================================================================
--- code/trunk/src/libraries/core/input/InputDevice.h	(revision 8857)
+++ code/trunk/src/libraries/core/input/InputDevice.h	(revision 8858)
@@ -43,5 +43,5 @@
 
 #include "util/Clock.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "InputState.h"
@@ -135,5 +135,5 @@
             //       invalid right until the subclass has been constructed!
             oisDevice_->setEventCallback(static_cast<DeviceClass*>(this));
-            COUT(4) << "Instantiated a " << this->getClassName() << std::endl;
+            orxout(verbose, context::input) << "Instantiated a " << this->getClassName() << endl;
         }
 
@@ -147,6 +147,6 @@
             catch (const OIS::Exception& ex)
             {
-                COUT(1) << this->getClassName() << " destruction failed: " << ex.eText << std::endl
-                        << "    Potential resource leak!" << std::endl;
+                orxout(internal_error, context::input) << this->getClassName() << " destruction failed: " << ex.eText << '\n'
+                                                       << "Potential resource leak!" << endl;
             }
         }
Index: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc	(revision 8857)
+++ code/trunk/src/libraries/core/input/InputManager.cc	(revision 8858)
@@ -100,5 +100,5 @@
         RegisterRootObject(InputManager);
 
-        CCOUT(4) << "Constructing..." << std::endl;
+        orxout(internal_status, context::input) << "InputManager: Constructing..." << endl;
 
         // Allocate space for the function call buffer
@@ -128,5 +128,5 @@
         ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(this);
 
-        CCOUT(4) << "Construction complete." << std::endl;
+        orxout(internal_status, context::input) << "InputManager: Construction complete." << endl;
         internalState_ = Nothing;
     }
@@ -143,5 +143,5 @@
     void InputManager::loadDevices()
     {
-        CCOUT(4) << "Loading input devices..." << std::endl;
+        orxout(verbose, context::input) << "InputManager: Loading input devices..." << endl;
 
         // When loading the devices they should not already be loaded
@@ -196,5 +196,5 @@
             // Exception-safety
             Loki::ScopeGuard guard = Loki::MakeGuard(OIS::InputManager::destroyInputSystem, oisInputManager_);
-            CCOUT(4) << "Created OIS input manager." << std::endl;
+            orxout(verbose, context::input) << "Created OIS input manager." << endl;
 
             if (oisInputManager_->getNumberOfDevices(OIS::OISKeyboard) > 0)
@@ -219,5 +219,5 @@
         this->updateActiveStates();
 
-        CCOUT(4) << "Input devices loaded." << std::endl;
+        orxout(verbose, context::input) << "Input devices loaded." << endl;
     }
 
@@ -233,10 +233,10 @@
             catch (const std::exception& ex)
             {
-                CCOUT(2) << "Warning: Failed to create Mouse:" << ex.what() << std::endl
-                         << "Proceeding without mouse support." << std::endl;
-            }
-        }
-        else
-            CCOUT(2) << "Warning: No mouse found! Proceeding without mouse support." << std::endl;
+                orxout(user_warning, context::input) << "Failed to create Mouse:" << ex.what() << '\n'
+                                                     << "Proceeding without mouse support." << endl;
+            }
+        }
+        else
+            orxout(user_warning, context::input) << "No mouse found! Proceeding without mouse support." << endl;
     }
 
@@ -252,5 +252,5 @@
             catch (const std::exception& ex)
             {
-                CCOUT(2) << "Warning: Failed to create joy stick: " << ex.what() << std::endl;
+                orxout(user_warning, context::input) << "Failed to create joy stick: " << ex.what() << endl;
             }
         }
@@ -270,5 +270,5 @@
     InputManager::~InputManager()
     {
-        CCOUT(3) << "Destroying..." << std::endl;
+        orxout(internal_status, context::input) << "InputManager: Destroying..." << endl;
 
         // Leave all active InputStates (except "empty")
@@ -295,5 +295,5 @@
         ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
 
-        CCOUT(3) << "Destruction complete." << std::endl;
+        orxout(internal_status, context::input) << "InputManager: Destruction complete." << endl;
     }
 
@@ -306,5 +306,5 @@
     void InputManager::destroyDevices()
     {
-        CCOUT(4) << "Destroying devices..." << std::endl;
+        orxout(verbose, context::input) << "InputManager: Destroying devices..." << endl;
 
         BOOST_FOREACH(InputDevice*& device, devices_)
@@ -315,5 +315,5 @@
             delete device;
             device = 0;
-            CCOUT(4) << className << " destroyed." << std::endl;
+            orxout(verbose, context::input) << className << " destroyed." << endl;
         }
         devices_.resize(InputDeviceEnumerator::FirstJoyStick);
@@ -326,11 +326,11 @@
         catch (const OIS::Exception& ex)
         {
-            COUT(1) << "OIS::InputManager destruction failed" << ex.eText << std::endl
-                    << "    Potential resource leak!" << std::endl;
+            orxout(internal_error, context::input) << "OIS::InputManager destruction failed" << ex.eText << '\n'
+                                                   << "Potential resource leak!" << endl;
         }
         oisInputManager_ = NULL;
 
         internalState_ |= Bad;
-        CCOUT(4) << "Destroyed devices." << std::endl;
+        orxout(verbose, context::input) << "Destroyed devices." << endl;
     }
 
@@ -343,5 +343,5 @@
     {
         if (internalState_ & Calibrating)
-            CCOUT(2) << "Warning: Cannot reload input system. Joy sticks are currently being calibrated." << std::endl;
+            orxout(internal_warning, context::input) << "Cannot reload input system. Joy sticks are currently being calibrated." << endl;
         else
             reloadInternal();
@@ -351,5 +351,5 @@
     void InputManager::reloadInternal()
     {
-        CCOUT(4) << "Reloading ..." << std::endl;
+        orxout(verbose, context::input) << "InputManager: Reloading ..." << endl;
 
         this->destroyDevices();
@@ -357,5 +357,5 @@
 
         internalState_ &= ~Bad;
-        CCOUT(4) << "Reloading complete." << std::endl;
+        orxout(verbose, context::input) << "InputManager: Reloading complete." << endl;
     }
 
@@ -471,6 +471,6 @@
     void InputManager::calibrate()
     {
-        COUT(0) << "Move all joy stick axes fully in all directions." << std::endl
-                << "When done, put the axex in the middle position and press enter." << std::endl;
+        orxout(message) << "Move all joy stick axes fully in all directions." << '\n'
+                        << "When done, put the axex in the middle position and press enter." << endl;
 
         BOOST_FOREACH(InputDevice* device, devices_)
@@ -495,5 +495,5 @@
         this->clearBuffers();
 
-        COUT(0) << "Calibration has been stored." << std::endl;
+        orxout(message) << "Calibration has been stored." << endl;
     }
 
@@ -535,6 +535,6 @@
                     if (it->second->getPriority() == priority)
                     {
-                        COUT(2) << "Warning: Could not add an InputState with the same priority '"
-                            << static_cast<int>(priority) << "' != 0." << std::endl;
+                        orxout(internal_warning, context::input) << "Could not add an InputState with the same priority '"
+                            << static_cast<int>(priority) << "' != 0." << endl;
                         return 0;
                     }
@@ -548,5 +548,5 @@
         else
         {
-            COUT(2) << "Warning: Could not add an InputState with the same name '" << name << "'." << std::endl;
+            orxout(internal_warning, context::input) << "Could not add an InputState with the same name '" << name << "'." << endl;
             return 0;
         }
@@ -598,5 +598,5 @@
         if (name == "empty")
         {
-            COUT(2) << "InputManager: Leaving the empty state is not allowed!" << std::endl;
+            orxout(internal_warning, context::input) << "InputManager: Leaving the empty state is not allowed!" << endl;
             return false;
         }
@@ -623,5 +623,5 @@
         if (name == "empty")
         {
-            COUT(2) << "InputManager: Removing the empty state is not allowed!" << std::endl;
+            orxout(internal_warning, context::input) << "InputManager: Removing the empty state is not allowed!" << endl;
             return false;
         }
@@ -649,5 +649,5 @@
         if (name == "empty")
         {
-            COUT(2) << "InputManager: Changing the empty state is not allowed!" << std::endl;
+            orxout(internal_warning, context::input) << "InputManager: Changing the empty state is not allowed!" << endl;
             return false;
         }
Index: code/trunk/src/libraries/core/input/JoyStick.cc
===================================================================
--- code/trunk/src/libraries/core/input/JoyStick.cc	(revision 8857)
+++ code/trunk/src/libraries/core/input/JoyStick.cc	(revision 8858)
@@ -80,5 +80,5 @@
         }
 
-        COUT(4) << "Created OIS joy stick with ID " << deviceName_ << std::endl;
+        orxout(verbose, context::input) << "Created OIS joy stick with ID " << deviceName_ << endl;
 
         // Load calibration
Index: code/trunk/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/trunk/src/libraries/core/input/KeyBinder.cc	(revision 8857)
+++ code/trunk/src/libraries/core/input/KeyBinder.cc	(revision 8858)
@@ -32,5 +32,5 @@
 #include <sstream>
 #include "util/Convert.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "core/ConfigValueIncludes.h"
@@ -251,5 +251,5 @@
     void KeyBinder::loadBindings()
     {
-        COUT(3) << "KeyBinder: Loading key bindings..." << std::endl;
+        orxout(internal_info, context::input) << "KeyBinder: Loading key bindings..." << endl;
 
         this->configFile_ = new ConfigFile(this->filename_, !PathConfig::buildDirectoryRun());
@@ -277,5 +277,5 @@
         }
 
-        COUT(3) << "KeyBinder: Loading key bindings done." << std::endl;
+        orxout(internal_info, context::input) << "KeyBinder: Loading key bindings done." << endl;
     }
 
@@ -294,5 +294,5 @@
         else
         {
-            COUT(2) << "Could not find key/button/axis with name '" << name << "'." << std::endl;
+            orxout(internal_warning, context::input) << "Could not find key/button/axis with name '" << name << "'." << endl;
             return false;
         }
Index: code/trunk/src/libraries/core/input/KeyBinderManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/KeyBinderManager.cc	(revision 8857)
+++ code/trunk/src/libraries/core/input/KeyBinderManager.cc	(revision 8858)
@@ -29,5 +29,5 @@
 #include "KeyBinderManager.h"
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Exception.h"
 #include "util/ScopedSingletonManager.h"
@@ -168,5 +168,5 @@
         if (!this->bBinding_)
         {
-            COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl;
+            orxout(message) << "Press any button/key or move a mouse/joystick axis" << endl;
             KeyDetector::getInstance().setCallback(createFunctor(&KeyBinderManager::keybindKeyPressed, this));
             InputManager::getInstance().enterState("detector");
@@ -185,9 +185,9 @@
             if (keyName == "Keys.KeyEscape")
             {
-                COUT(0) << "Keybinding aborted." << std::endl;
+                orxout(message) << "Keybinding aborted." << endl;
             }
             else
             {
-                COUT(0) << "Binding string \"" << command_ << "\" on key '" << keyName << "'" << std::endl;
+                orxout(message) << "Binding string \"" << command_ << "\" on key '" << keyName << "'" << endl;
                 this->currentBinder_->setBinding(command_, keyName, bTemporary_);
             }
Index: code/trunk/src/libraries/network/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/network/CMakeLists.txt	(revision 8857)
+++ code/trunk/src/libraries/network/CMakeLists.txt	(revision 8858)
@@ -19,5 +19,4 @@
 
 SET_SOURCE_FILES(NETWORK_SRC_FILES
-  ChatListener.cc
   Client.cc
   ClientConnection.cc
@@ -45,5 +44,4 @@
 
 SET_SOURCE_FILES(NETWORK_HDR_FILES
-  ChatListener.h
   Client.h
   ClientConnection.h
@@ -61,4 +59,5 @@
   WANDiscovery.h
   MasterServerComm.h
+  NetworkChatListener.h
   NetworkFunction.h
   NetworkPrecompiledHeaders.h
Index: code/trunk/src/libraries/network/ChatListener.cc
===================================================================
--- code/trunk/src/libraries/network/ChatListener.cc	(revision 8857)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- *   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 "ChatListener.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
-    ChatListener::ChatListener()
-    {
-        RegisterRootObject(ChatListener);
-    }
-
-    //void ChatListener::incomingChat( const std::string& message,
-      //unsigned int senderID )
-    //{
-      //COUT(0) << "Chat: \"" << message << "\"\n";
-
-
-    //}
-
-
-}
-
-
Index: code/trunk/src/libraries/network/ChatListener.h
===================================================================
--- code/trunk/src/libraries/network/ChatListener.h	(revision 8857)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- *   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 _NETWORK_ChatListener__
-#define _NETWORK_ChatListener__
-
-#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
-
-namespace orxonox
-{
-    class _NetworkExport ChatListener : virtual public OrxonoxClass
-    {
-        public:
-            /* constructor, destructor */
-            ChatListener();
-            virtual ~ChatListener() {}
-
-            /* What to do with incoming chat */
-            virtual void incomingChat(const std::string& message, unsigned int senderID) = 0;
-    };
-}
-
-#endif /* _NETWORK_ChatListener__ */
Index: code/trunk/src/libraries/network/Client.cc
===================================================================
--- code/trunk/src/libraries/network/Client.cc	(revision 8857)
+++ code/trunk/src/libraries/network/Client.cc	(revision 8858)
@@ -44,5 +44,5 @@
 
 #include "util/Clock.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/ScopedSingletonManager.h"
 #include "synchronisable/Synchronisable.h"
@@ -116,26 +116,30 @@
   }
 
-  bool Client::processChat(const std::string& message, unsigned int playerID)
-  {
-//    COUT(1) << "Player " << playerID << ": " << message << std::endl;
-    return true;
-  }
-
   void Client::printRTT()
   {
-    COUT(0) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl;
-  }
-
-  /**
-   * This function implements the method of sending a chat message to the server
+    orxout(message) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl;
+  }
+
+  /**
+   * @brief Sends a chat message to the server.
    * @param message message to be sent
-   * @return result(true/false)
+   * @param sourceID the ID of the sender
+   * @param targetID the ID of the receiver
    */
-  bool Client::chat(const std::string& message)
-  {
-    packet::Chat *m = new packet::Chat(message, Host::getPlayerID());
-    return m->send(static_cast<Host*>(this));
-  }
-
+  void Client::doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+    // send the message to the server
+    packet::Chat* packet = new packet::Chat(message, sourceID, targetID);
+    packet->send(static_cast<Host*>(this));
+  }
+
+  /**
+   * @brief Gets called if a packet::Chat packet is received. Calls the parent function which passes the message to the listeners.
+   */
+  void Client::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+    // call the parent function which passes the message to the listeners
+    Host::doReceiveChat(message, sourceID, targetID);
+  }
 
   /**
@@ -150,8 +154,7 @@
     {
       timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
-      //     COUT(3) << '.';
       if ( isConnected() && isSynched_ )
       {
-        COUT(4) << "popping partial gamestate: " << std::endl;
+        orxout(verbose, context::network) << "popping partial gamestate: " << endl;
 //         packet::Gamestate *gs = GamestateClient::getGamestate();
         if( GamestateManager::update() )
@@ -166,7 +169,7 @@
         //assert(gs); <--- there might be the case that no data has to be sent, so its commented out now
 //         if(gs){
-//           COUT(4) << "client tick: sending gs " << gs << std::endl;
+//           orxout(verbose, context::network) << "client tick: sending gs " << gs << endl;
 //           if( !gs->send() )
-//             COUT(2) << "Problem adding partial gamestate to queue" << std::endl;
+//             orxout(internal_warning, context::network) << "Problem adding partial gamestate to queue" << endl;
 //         // gs gets automatically deleted by enet callback
 //         }
@@ -204,5 +207,5 @@
     Game::getInstance().popState();
   }
-  
+
   void Client::processPacket(packet::Packet* packet)
   {
@@ -217,7 +220,3 @@
       packet->process(static_cast<Host*>(this));
   }
-
-
-
-
 }
Index: code/trunk/src/libraries/network/Client.h
===================================================================
--- code/trunk/src/libraries/network/Client.h	(revision 8857)
+++ code/trunk/src/libraries/network/Client.h	(revision 8858)
@@ -73,5 +73,5 @@
     Client();
     ~Client();
-    
+
     static Client* getInstance(){ return singletonPtr_s; } // tolua_export
 
@@ -81,7 +81,6 @@
     void queuePacket(ENetPacket* packet, int clientID, uint8_t channelID);
     virtual bool sendPacket( packet::Packet* packet ){ return packet->send( static_cast<Host*>(this) ); }
-    bool processChat(const std::string& message, unsigned int playerID);
-    virtual bool chat(const std::string& message);
-    virtual bool broadcast(const std::string& message) { return false; }
+    virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
+    virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
     virtual void printRTT();
 
Index: code/trunk/src/libraries/network/ClientConnection.cc
===================================================================
--- code/trunk/src/libraries/network/ClientConnection.cc	(revision 8857)
+++ code/trunk/src/libraries/network/ClientConnection.cc	(revision 8858)
@@ -32,5 +32,5 @@
 #define WIN32_LEAN_AND_MEAN
 #include <enet/enet.h>
-#include "util/Debug.h"
+#include "util/Output.h"
 
 namespace orxonox
@@ -60,5 +60,5 @@
   void ClientConnection::setServerAddress( const std::string& serverAddress ) {
     if (enet_address_set_host (this->serverAddress_, serverAddress.c_str()) < 0)
-        COUT(1) << "Error: Could not resolve \"" << serverAddress << "\"." << std::endl;
+        orxout(internal_error, context::network) << "Could not resolve \"" << serverAddress << "\"." << endl;
   }
 
@@ -76,5 +76,5 @@
     if ( this->host_ == NULL )
     {
-      COUT(1) << "ClientConnection: host_ == NULL" << std::endl;
+      orxout(internal_error, context::network) << "ClientConnection: host_ == NULL" << endl;
       // error handling
       return false;
@@ -86,14 +86,14 @@
     assert( this->host_->socket4 != ENET_SOCKET_NULL || this->host_->socket6 != ENET_SOCKET_NULL );
     if (this->host_->socket4 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv4 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv4 Socket failed." << endl;
     else if (this->host_->socket6 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv6 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv6 Socket failed." << endl;
     else
-        COUT(3) << "Info: Using IPv4 and IPv6 Sockets." << std::endl;
+        orxout(internal_info, context::network) << "Using IPv4 and IPv6 Sockets." << endl;
 
     this->server_ = enet_host_connect(this->host_, serverAddress_, NETWORK_CHANNEL_COUNT, 0);
     if ( this->server_==NULL )
     {
-      COUT(1) << "ClientConnection: server_ == NULL" << std::endl;
+      orxout(internal_error, context::network) << "ClientConnection: server_ == NULL" << endl;
       // error handling
       return false;
@@ -113,5 +113,5 @@
       }
     }
-    COUT(1) << "Could not connect to server" << endl;
+    orxout(user_error, context::network) << "Could not connect to server" << endl;
     return false;
   }
@@ -140,5 +140,5 @@
             break;
           case ENET_EVENT_TYPE_DISCONNECT:
-            COUT(4) << "received disconnect confirmation from server" << endl;
+            orxout(verbose, context::network) << "received disconnect confirmation from server" << endl;
             this->connectionClosed();
             return true;
@@ -167,5 +167,5 @@
   {
     this->established_=false;
-    COUT(1) << "Received disconnect Packet from Server!" << endl;
+    orxout(internal_error, context::network) << "Received disconnect Packet from Server!" << endl;
         // server closed the connection
     this->stopCommunicationThread();
Index: code/trunk/src/libraries/network/Connection.cc
===================================================================
--- code/trunk/src/libraries/network/Connection.cc	(revision 8857)
+++ code/trunk/src/libraries/network/Connection.cc	(revision 8858)
@@ -144,5 +144,5 @@
       while( outgoingEventsCount > 0 )
       {
-//         COUT(0) << "outgoing event" << endl;
+//         orxout(verbose, context::network) << "outgoing event" << endl;
         this->outgoingEventsMutex_->lock();
         outgoingEvent outEvent = this->outgoingEvents_.front();
Index: code/trunk/src/libraries/network/GamestateManager.cc
===================================================================
--- code/trunk/src/libraries/network/GamestateManager.cc	(revision 8857)
+++ code/trunk/src/libraries/network/GamestateManager.cc	(revision 8858)
@@ -52,5 +52,5 @@
 #include "core/command/Executor.h"
 #include "core/GameMode.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/Clock.h"
 #include "util/OrxAssert.h"
@@ -128,10 +128,10 @@
     if( !this->sendPacket(ack))
     {
-      COUT(3) << "could not ack gamestate: " << gamestateID << std::endl;
+      orxout(internal_warning, context::network) << "could not ack gamestate: " << gamestateID << endl;
       return false;
     }
     else
     {
-      COUT(5) << "acked a gamestate: " << gamestateID << std::endl;
+      orxout(verbose_more, context::network) << "acked a gamestate: " << gamestateID << endl;
       return true;
     }
@@ -182,9 +182,9 @@
       if( !peerIt->second.isSynched )
       {
-        COUT(5) << "Server: not sending gamestate" << std::endl;
+        orxout(verbose_more, context::network) << "Server: not sending gamestate" << endl;
         continue;
       }
-      COUT(5) << "client id: " << peerIt->first << std::endl;
-      COUT(5) << "Server: doing gamestate gamestate preparation" << std::endl;
+      orxout(verbose_more, context::network) << "client id: " << peerIt->first << endl;
+      orxout(verbose_more, context::network) << "Server: doing gamestate gamestate preparation" << endl;
       int peerID = peerIt->first; //get client id
 
@@ -256,10 +256,10 @@
 //     OrxVerify(gs->compressData(), "");
     clock.capture();
-    COUT(5) << "diff and compress time: " << clock.getDeltaTime() << endl;
-//     COUT(5) << "sending gamestate with id " << gs->getID();
+    orxout(verbose_more, context::network) << "diff and compress time: " << clock.getDeltaTime() << endl;
+//     orxout(verbose_more, context::network) << "sending gamestate with id " << gs->getID();
 //     if(gamestate->isDiffed())
-//       COUT(5) << " and baseid " << gs->getBaseID() << endl;
+//       orxout(verbose_more, context::network) << " and baseid " << gs->getBaseID() << endl;
 //     else
-//       COUT(5) << endl;
+//       orxout(verbose_more, context::network) << endl;
     gs->setPeerID(peerID);
     destgamestate = gs;
@@ -291,5 +291,5 @@
     if( gamestateID <= curid && curid != GAMESTATEID_INITIAL )
         return true;
-COUT(4) << "acking gamestate " << gamestateID << " for peerID: " << peerID << " curid: " << curid << std::endl;
+orxout(verbose, context::network) << "acking gamestate " << gamestateID << " for peerID: " << peerID << " curid: " << curid << endl;
     std::map<uint32_t, packet::Gamestate*>::iterator it2;
     for( it2=it->second.gamestates.begin(); it2!=it->second.gamestates.end(); )
Index: code/trunk/src/libraries/network/Host.cc
===================================================================
--- code/trunk/src/libraries/network/Host.cc	(revision 8857)
+++ code/trunk/src/libraries/network/Host.cc	(revision 8858)
@@ -32,7 +32,8 @@
 #include <string>
 
+#include "core/CoreIncludes.h"
 #include "core/ObjectList.h"
 #include "core/command/ConsoleCommand.h"
-#include "ChatListener.h"
+#include "NetworkChatListener.h"
 
 namespace orxonox {
@@ -41,5 +42,4 @@
   static const std::string __CC_printRTT_name = "printRTT";
 
-  SetConsoleCommand("chat", &Host::Chat);
   SetConsoleCommand(__CC_printRTT_group, __CC_printRTT_name, &Host::printRTT);
 
@@ -89,66 +89,26 @@
   }
 
-  void Host::Chat(const std::string& message)
+  /**
+   * @brief Sends a chat message through the network.
+   * @param message message to be sent
+   * @param sourceID the ID of the sender
+   * @param targetID the ID of the receiver
+   */
+  void Host::sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
   {
-    if(instances_s.size()==0)
-    {
-      for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-        it->incomingChat(message, 0);
-//      return true;
-    }
-    else
-    {
-      bool result = true;
-      for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
-      {
-        if( (*it)->isActive() )
-        {
-          if( !(*it)->chat(message) )
-            result = false;
-        }
-      }
-//      return result;
-    }
+    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
+      if( (*it)->isActive() )
+        (*it)->doSendChat(message, sourceID, targetID);
   }
 
-  bool Host::Broadcast(const std::string& message)
+  /**
+   * @brief Gets called if a packet::Chat packet is received. Passes the message to the listeners.
+   */
+  void Host::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
   {
-    if(instances_s.size()==0)
-    {
-      for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-        it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
-      return true;
-    }
-    else
-    {
-      bool result = true;
-      for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
-      {
-        if( (*it)->isActive() )
-        {
-          if( !(*it)->broadcast(message) )
-            result = false;
-        }
-      }
-      return result;
-    }
+    for (ObjectList<NetworkChatListener>::iterator it = ObjectList<NetworkChatListener>::begin(); it != ObjectList<NetworkChatListener>::end(); ++it)
+      it->incomingChat(message, sourceID);
   }
 
-  bool Host::incomingChat(const std::string& message, unsigned int playerID)
-  {
-    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-      it->incomingChat(message, playerID);
-
-    bool result = true;
-    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
-    {
-      if( (*it)->isActive() )
-      {
-        if( !(*it)->processChat(message, playerID) )
-          result = false;
-      }
-    }
-    return result;
-  }
 
   bool Host::isServer()
@@ -156,10 +116,13 @@
     for (std::vector<Host*>::iterator it=instances_s.begin(); it!=instances_s.end(); ++it )
     {
-      if( (*it)->isServer_() )
-        return true;
+      if( (*it)->isActive() )
+      {
+        if( (*it)->isServer_() )
+          return true;
+      }
     }
     return false;
   }
-  
+
   Host* Host::getActiveInstance()
   {
@@ -176,3 +139,12 @@
 
 
+  //////////////////////////////////////////////////////////////////////////
+  // NetworkChatListener                                                  //
+  //////////////////////////////////////////////////////////////////////////
+
+  NetworkChatListener::NetworkChatListener()
+  {
+      RegisterRootObject(NetworkChatListener);
+  }
+
 }//namespace orxonox
Index: code/trunk/src/libraries/network/Host.h
===================================================================
--- code/trunk/src/libraries/network/Host.h	(revision 8857)
+++ code/trunk/src/libraries/network/Host.h	(revision 8858)
@@ -52,15 +52,9 @@
 class _NetworkExport Host: public GamestateManager
 {
+  friend class packet::Chat;
+
   private:
-    //TODO add these functions or adequate
-    //virtual bool processChat(packet::Chat *message, unsigned int clientID)=0;
-    //virtual bool sendChat(packet::Chat *chat)=0;
     virtual void queuePacket(ENetPacket *packet, int clientID, uint8_t channelID)=0;
-    virtual bool chat(const std::string& message)=0;
-    virtual bool broadcast(const std::string& message)=0;
-    virtual bool processChat(const std::string& message, unsigned int playerID)=0;
     virtual bool isServer_()=0;
-
-
 
   protected:
@@ -68,5 +62,7 @@
     virtual ~Host();
     void setActive( bool bActive ){ bIsActive_ = bActive; }
-//     static Host *instance_;
+
+    virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)=0;
+    virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)=0;
 
   public:
@@ -74,12 +70,8 @@
     static bool running(){ return instances_s.size(); }
     static void addPacket(ENetPacket* packet, int clientID = NETWORK_PEER_ID_SERVER, uint8_t channelID = 0);
-    //static bool chat(std::string& message);
-//     static bool receiveChat(packet::Chat *message, unsigned int clientID);
     static unsigned int getPlayerID(){ return clientID_s; }
     static void setClientID(unsigned int id){ clientID_s = id; }
     static bool isServer();
-    static void Chat(const std::string& message);
-    static bool Broadcast(const std::string& message);
-    static bool incomingChat(const std::string& message, unsigned int playerID);
+    static void sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
     virtual void printRTT()=0;
     bool isActive(){ return bIsActive_; }
Index: code/trunk/src/libraries/network/LANDiscoverable.cc
===================================================================
--- code/trunk/src/libraries/network/LANDiscoverable.cc	(revision 8857)
+++ code/trunk/src/libraries/network/LANDiscoverable.cc	(revision 8858)
@@ -33,5 +33,5 @@
 #include <cstring>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "packet/ServerInformation.h"
 
@@ -71,5 +71,5 @@
       this->host_ = enet_host_create( &bindAddress, 10, 0, 0, 0 );
       if ( this->host_ == NULL )
-          COUT(1) << "LANDiscoverable: host_ == NULL" << std::endl;
+          orxout(internal_error, context::network) << "LANDiscoverable: host_ == NULL" << endl;
     }
     else
@@ -94,5 +94,5 @@
       {
         case ENET_EVENT_TYPE_CONNECT:
-            COUT(4) << "Received LAN discovery connect from client " << event.peer->host->receivedAddress << std::endl;
+            orxout(verbose, context::network) << "Received LAN discovery connect from client " << event.peer->host->receivedAddress << endl;
             break;
         case ENET_EVENT_TYPE_DISCONNECT:
@@ -102,5 +102,5 @@
           if( strcmp( LAN_DISCOVERY_MESSAGE, (char*)event.packet->data ) == 0 )      // check for a suitable orxonox client
           {
-            COUT(3) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << std::endl;
+            orxout(internal_info, context::network) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << endl;
             packet::ServerInformation info;
             info.setServerName("Orxonox Server");
Index: code/trunk/src/libraries/network/LANDiscovery.cc
===================================================================
--- code/trunk/src/libraries/network/LANDiscovery.cc	(revision 8857)
+++ code/trunk/src/libraries/network/LANDiscovery.cc	(revision 8858)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Oliver Scheuss
  *   Co-authors:
  *      ...
@@ -44,5 +44,5 @@
     this->host_ = enet_host_create(NULL, 10, 0, 0, 0 );
     if ( this->host_ == NULL )
-        COUT(1) << "LANDiscovery: host_ == NULL" << std::endl;
+        orxout(internal_error, context::network) << "LANDiscovery: host_ == NULL" << endl;
   }
 
@@ -66,5 +66,5 @@
     peer = enet_host_connect(this->host_, &address, 0, 0);
     if (peer == NULL)
-        COUT(1) << "Error: Could not send LAN discovery to IPv4 Broadcast." << std::endl;
+        orxout(internal_error, context::network) << "Could not send LAN discovery to IPv4 Broadcast." << endl;
 
     /* IPv6 */
@@ -72,5 +72,5 @@
     peer = enet_host_connect(this->host_, &address, 0, 0);
     if (peer == NULL)
-        COUT(1) << "Error: Could not send LAN discovery to IPv6 Multicast." << std::endl;
+        orxout(internal_error, context::network) << "Could not send LAN discovery to IPv6 Multicast." << endl;
 
     ENetEvent event;
@@ -81,5 +81,5 @@
         case ENET_EVENT_TYPE_CONNECT:
         {
-          COUT(4) << "Received LAN discovery connect from server " << event.peer->host->receivedAddress << std::endl;
+          orxout(verbose, context::network) << "Received LAN discovery connect from server " << event.peer->host->receivedAddress << endl;
           ENetPacket* packet = enet_packet_create(LAN_DISCOVERY_MESSAGE, strlen(LAN_DISCOVERY_MESSAGE)+1, ENET_PACKET_FLAG_RELIABLE);
           enet_peer_send(event.peer, 0, packet);
@@ -89,5 +89,5 @@
           {
             packet::ServerInformation info(&event);
-            COUT(3) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", RTT: " << info.getServerRTT() << endl;
+            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", RTT: " << info.getServerRTT() << endl;
             std::vector<packet::ServerInformation>::iterator it;
             for( it=this->servers_.begin(); it!=this->servers_.end(); ++it )
Index: code/trunk/src/libraries/network/LANDiscovery.h
===================================================================
--- code/trunk/src/libraries/network/LANDiscovery.h	(revision 8857)
+++ code/trunk/src/libraries/network/LANDiscovery.h	(revision 8858)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Oliver Scheuss
  *   Co-authors:
  *      ...
Index: code/trunk/src/libraries/network/MasterServer.cc
===================================================================
--- code/trunk/src/libraries/network/MasterServer.cc	(revision 8857)
+++ code/trunk/src/libraries/network/MasterServer.cc	(revision 8858)
@@ -38,5 +38,6 @@
   helper_output_debug( ENetEvent *event, char *addrconv )
   {
-    COUT(4) << "A packet of length" 
+    orxout(verbose, context::master_server)
+      << "A packet of length" 
       << event->packet->dataLength
       << " containing "
@@ -45,5 +46,5 @@
       << addrconv 
       << " on channel "
-      << event->channelID << "\n";
+      << event->channelID << endl;
   }
 
@@ -66,5 +67,5 @@
           + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 );
       if( !tosend ) 
-      { COUT(2) << "Masterserver.cc: Memory allocation failed.\n";
+      { orxout(internal_warning, context::master_server) << "Masterserver.cc: Memory allocation failed." << endl;
         continue;
       } 
@@ -108,5 +109,5 @@
   { /* check for bad parameters */
     if( !event )
-    { COUT(2) << "MasterServer::eventConnect: No event given.\n" ;
+    { orxout(internal_warning, context::master_server) << "MasterServer::eventConnect: No event given." << endl;
       return -1;
     }
@@ -117,8 +118,8 @@
 
     /* output debug info */
-    COUT(4) << "A new client connected from " 
+    orxout(verbose, context::master_server) << "A new client connected from " 
       << addrconv 
       << " on port " 
-      << event->peer->address.port << "\n";
+      << event->peer->address.port << endl;
 
     /* store string form of address here */
@@ -134,10 +135,10 @@
   { /* check for bad parameters */
     if( !event )
-    { COUT(2) << "No event given.\n";
+    { orxout(internal_warning, context::master_server) << "No event given." << endl;
       return -1;
     }
 
     /* output that the disconnect happened */
-    COUT(4) << (char*)event->peer->data << " disconnected.\n";
+    orxout(verbose, context::master_server) << (char*)event->peer->data << " disconnected." << endl;
 
     /* create string from peer data */
@@ -159,5 +160,5 @@
   { /* validate packet */
     if( !event || !(event->packet) || !(event->peer) )
-    { COUT(2) << "No complete event given.\n";
+    { orxout(internal_warning, context::master_server) << "No complete event given." << endl;
       return -1;
     }
@@ -182,6 +183,6 @@
         
         /* tell people we did so */
-        COUT(2) << "Added new server to list: " << 
-          packet::ServerInformation( event ).getServerIP() << "\n";
+        orxout(internal_info, context::master_server) << "Added new server to list: " << 
+          packet::ServerInformation( event ).getServerIP() << endl;
       }
 
@@ -197,5 +198,5 @@
 
         /* tell the user */
-        COUT(2) << "Removed server " << name << " from list.\n";
+        orxout(internal_info, context::master_server) << "Removed server " << name << " from list." << endl;
       }
 
@@ -230,5 +231,5 @@
     if( event == NULL )
     { 
-      COUT(1) << "Could not create ENetEvent structure, exiting.\n";
+      orxout(user_error, context::master_server) << "Could not create ENetEvent structure, exiting." << endl;
       exit( EXIT_FAILURE );
     }
@@ -263,5 +264,5 @@
     /***** INITIALIZE NETWORKING *****/
     if( enet_initialize () != 0)
-    { COUT(1) << "An error occurred while initializing ENet.\n";
+    { orxout(user_error, context::master_server) << "An error occurred while initializing ENet." << endl;
       exit( EXIT_FAILURE );
     }
@@ -285,6 +286,6 @@
     /* see if creation worked */
     if( !this->server )
-    { COUT(1) << 
-        "An error occurred while trying to create an ENet server host.\n";
+    { orxout(user_error, context::master_server) << 
+        "An error occurred while trying to create an ENet server host." << endl;
       exit( EXIT_FAILURE );
     }
@@ -294,5 +295,5 @@
 
     /* tell people we're now initialized */
-    COUT(0) << "MasterServer initialized, waiting for connections.\n";
+    orxout(internal_status, context::master_server) << "MasterServer initialized, waiting for connections." << endl;
   }
 
Index: code/trunk/src/libraries/network/MasterServerComm.cc
===================================================================
--- code/trunk/src/libraries/network/MasterServerComm.cc	(revision 8857)
+++ code/trunk/src/libraries/network/MasterServerComm.cc	(revision 8858)
@@ -28,5 +28,6 @@
 
 #include "MasterServerComm.h"
-#include "util/Debug.h"
+#include "util/Output.h"
+#include "WANDiscovery.h"
 
 namespace orxonox
@@ -44,5 +45,5 @@
     /* initialize Enet */
     if( enet_initialize () != 0 )
-    { COUT(1) << "An error occurred while initializing ENet.\n";
+    { orxout(internal_error, context::master_server) << "An error occurred while initializing ENet." << endl;
       return 1;
     }
@@ -61,6 +62,6 @@
     /* see if it worked */
     if (this->client == NULL)
-    { COUT(1) << "An error occurred while trying to create an " 
-        << "ENet client host.\n";
+    { orxout(internal_error, context::master_server) << "An error occurred while trying to create an " 
+        << "ENet client host." << endl;
       return 1;
     }
@@ -85,6 +86,6 @@
 
     if( this->peer == NULL )
-    { COUT(2) << "ERROR: No available peers for initiating an ENet"
-        << " connection.\n";
+    { orxout(internal_error, context::master_server) << "No available peers for initiating an ENet"
+        << " connection." << endl;
       return -1;
     }
@@ -93,9 +94,9 @@
     if (enet_host_service (this->client, &this->event, 500) > 0 &&
         this->event.type == ENET_EVENT_TYPE_CONNECT )
-      COUT(3) << "Connection to master server succeeded.\n";
+      orxout(internal_info, context::master_server) << "Connection to master server succeeded." << endl;
     else
     {
       enet_peer_reset (this->peer);
-      COUT(2) << "ERROR: connection to " << address << " failed.\n";
+      orxout(internal_warning, context::master_server) << "Connection to " << address << " failed." << endl;
       return -1;
     }
@@ -128,5 +129,5 @@
 
         case ENET_EVENT_TYPE_DISCONNECT:
-          COUT(4) << "Disconnect from master server successful.\n"; 
+          orxout(verbose, context::master_server) << "Disconnect from master server successful." << endl; 
           return 0;
         default: break;
@@ -149,10 +150,9 @@
    * so we can also make callbacks from objects
    */
-  int MasterServerComm::pollForReply( int (*callback)( char*, ENetEvent* ),
-    int delayms )
+  int MasterServerComm::pollForReply( WANDiscovery* listener, int delayms )
   { 
     /* see whether anything happened */
     /* WORK MARK REMOVE THIS OUTPUT */
-    COUT(2) << "polling masterserver...\n";
+    orxout(verbose, context::master_server) << "polling masterserver..." << endl;
 
     /* address buffer */
@@ -176,5 +176,5 @@
           addrconv = (char *) calloc( 50, 1 );
           if( !addrconv ) 
-          { COUT(2) << "MasterServerComm.cc: Could not allocate memory!\n";
+          { orxout(internal_warning, context::master_server) << "MasterServerComm.cc: Could not allocate memory!" << endl;
             break;
           }
@@ -185,5 +185,5 @@
 
           /* DEBUG */
-          COUT(3) << "MasterServer Debug: A packet of length " 
+          orxout(verbose, context::master_server) << "MasterServer Debug: A packet of length " 
             << this->event.packet->dataLength 
             << " containing " << this->event.packet->data
@@ -193,6 +193,6 @@
 
           /* call the supplied callback, if any. */
-          if( (*callback) != NULL )
-            retval = (*callback)( addrconv, &(this->event) );
+          if( listener != NULL )
+            retval = listener->rhandler( addrconv, &(this->event) );
 
           /* clean up */
Index: code/trunk/src/libraries/network/MasterServerComm.h
===================================================================
--- code/trunk/src/libraries/network/MasterServerComm.h	(revision 8857)
+++ code/trunk/src/libraries/network/MasterServerComm.h	(revision 8858)
@@ -93,5 +93,5 @@
        * 
        * Poll the master server for new data and act accordingly */
-      int pollForReply( int (*callback)( char*, ENetEvent* ), int delayms );
+      int pollForReply( WANDiscovery* listener, int delayms );
 
     private:
Index: code/trunk/src/libraries/network/NetworkChatListener.h
===================================================================
--- code/trunk/src/libraries/network/NetworkChatListener.h	(revision 8858)
+++ code/trunk/src/libraries/network/NetworkChatListener.h	(revision 8858)
@@ -0,0 +1,63 @@
+/*
+ *   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 _NetworkChatListener_H__
+#define _NetworkChatListener_H__
+
+#include "NetworkPrereqs.h"
+
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+    /**
+        @brief The only function of this interface, incomingChat(), gets called whenever a chat
+        message was received through the network.
+
+        This interface exists mostly to resolve circular dependencies between the chat functions
+        in Host and ChatManager. ChatManager is the main derivative of this interface.
+    */
+    class _NetworkExport NetworkChatListener : virtual public OrxonoxClass
+    {
+        friend class Host;
+
+        public:
+            NetworkChatListener(); // implemented in Host.cc
+            virtual ~NetworkChatListener() {}
+
+        protected:
+            /**
+                @brief Gets called when a chat message was received through the network.
+                @param message The message
+                @param sourceID The (network) client ID of the sender
+            */
+            virtual void incomingChat(const std::string& message, unsigned int sourceID) = 0;
+    };
+}
+
+#endif /* _NetworkChatListener_H__ */
Index: code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h
===================================================================
--- code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h	(revision 8857)
+++ code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h	(revision 8858)
@@ -52,5 +52,5 @@
 #include <set>      // 20
 
-#include "util/Debug.h"      // 20
+#include "util/Output.h"      // 20
 #include <loki/TypeTraits.h> // 18
 
Index: code/trunk/src/libraries/network/NetworkPrereqs.h
===================================================================
--- code/trunk/src/libraries/network/NetworkPrereqs.h	(revision 8857)
+++ code/trunk/src/libraries/network/NetworkPrereqs.h	(revision 8858)
@@ -118,5 +118,4 @@
 namespace orxonox
 {
-  class ChatListener;
   class Client;
   class ClientConnection;
@@ -130,4 +129,7 @@
   class GamestateManager;
   class Host;
+  class MasterServer;
+  class MasterServerComm;
+  class NetworkChatListener;
   class NetworkFunctionBase;
   struct NetworkFunctionPointer;
@@ -136,7 +138,10 @@
   class NetworkMemberFunction;
   class NetworkMemberFunctionBase;
+  class PeerList;
   class Server;
   class ServerConnection;
   class TrafficControl;
+  class WANDiscoverable;
+  class WANDiscovery;
 
   // packet
Index: code/trunk/src/libraries/network/PeerList.cc
===================================================================
--- code/trunk/src/libraries/network/PeerList.cc	(revision 8857)
+++ code/trunk/src/libraries/network/PeerList.cc	(revision 8858)
@@ -28,6 +28,8 @@
 
 #include "PeerList.h"
-#include <network/packet/ServerInformation.h>
+
 #include <cstdio>
+#include "util/Output.h"
+#include "network/packet/ServerInformation.h"
 
 namespace orxonox
@@ -40,5 +42,5 @@
   { /* error correction */
     if( toadd == NULL ) 
-    { fprintf( stderr, "PeerList::addPeer: empty peer given.\n" );
+    { orxout(internal_error, context::master_server) << "PeerList::addPeer: empty peer given." << endl;
       return -1;
     }
Index: code/trunk/src/libraries/network/Server.cc
===================================================================
--- code/trunk/src/libraries/network/Server.cc	(revision 8857)
+++ code/trunk/src/libraries/network/Server.cc	(revision 8858)
@@ -47,5 +47,5 @@
 
 #include "util/Clock.h"
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "core/ObjectList.h"
 #include "core/command/Executor.h"
@@ -56,9 +56,7 @@
 #include "packet/Gamestate.h"
 #include "packet/Welcome.h"
-#include "ChatListener.h"
 // #include "ClientInformation.h"
 #include "FunctionCallManager.h"
 #include "GamestateManager.h"
-#include "WANDiscovery.h"
 
 namespace orxonox
@@ -100,12 +98,4 @@
   }
 
-
-  /** helper that connects to the master server */
-  void Server::helper_ConnectToMasterserver()
-  {
-//     WANDiscovery::getInstance().msc.sendRequest( MSPROTO_GAME_SERVER " " 
-//       MSPROTO_REGISTER_SERVER );
-  }
-
   /**
   * This function opens the server by creating the listener thread
@@ -114,7 +104,7 @@
   {
     Host::setActive(true);
-    COUT(4) << "opening server" << endl;
+    orxout(verbose, context::network) << "opening server" << endl;
     this->openListener();
-    
+
     /* make discoverable on LAN */
     LANDiscoverable::setActivity(true);
@@ -122,8 +112,4 @@
     /* make discoverable on WAN */
     WANDiscoverable::setActivity(true);
-    /* TODO this needs to be optional, we need a switch from the UI to
-     * enable/disable this 
-     */
-//     helper_ConnectToMasterserver();
 
     /* done */
@@ -137,55 +123,15 @@
   {
     Host::setActive(false);
-    COUT(4) << "closing server" << endl;
+    orxout(verbose, context::network) << "closing server" << endl;
     this->disconnectClients();
     this->closeListener();
 
     /* tell master server we're closing */
-    COUT(2) << "disconnecting." << endl;
-    WANDiscoverable::setActivity(false);    
-    COUT(2) << "disconnecting done" << endl;
+    orxout(internal_info, context::network) << "disconnecting." << endl;
+    WANDiscoverable::setActivity(false);
+    orxout(internal_info, context::network) << "disconnecting done" << endl;
 
     LANDiscoverable::setActivity(false);
     return;
-  }
-
-  bool Server::processChat(const std::string& message, unsigned int playerID)
-  {
-//     ClientInformation *temp = ClientInformation::getBegin();
-    packet::Chat *chat;
-//     while(temp){
-    chat = new packet::Chat(message, playerID);
-    chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
-    chat->send( static_cast<Host*>(this) );
-//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
-//       temp = temp->next();
-//     }
-//    COUT(1) << "Player " << playerID << ": " << message << std::endl;
-    return true;
-  }
-
-
-  /* handle incoming data */
-  int rephandler( char *addr, ENetEvent *ev )
-  { 
-    /* reply to pings */
-    if( !strncmp( (char *)ev->packet->data, MSPROTO_PING_GAMESERVER, 
-      MSPROTO_PING_GAMESERVER_LEN ) )
-      //this->msc.sendRequest( MSPROTO_ACK );
-      /* NOTE implement this after pollForReply
-       * reimplementation 
-       */
-      return 0;
-
-    /* done handling, return all ok code 0 */
-    return 0;
-  }
-
-  void Server::helper_HandleMasterServerRequests()
-  { 
-    /* poll the master server for replies and see whether something 
-     * has to be done or changed.
-     */
-    //WANDiscovery::getInstance().msc.pollForReply( rhandler, 10 );
   }
 
@@ -202,8 +148,4 @@
     // receive and process incoming discovery packets
     LANDiscoverable::update();
-    
-    // receive and process requests from master server
-    /* todo */
-    //helper_HandleMasterServerRequests();
 
     if ( GamestateManager::hasPeers() )
@@ -246,5 +188,5 @@
   {
 //     for( ClientInformation* temp=ClientInformation::getBegin(); temp!=0; temp=temp->next() )
-//       COUT(0) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
+//       orxout(message) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
   }
 
@@ -268,11 +210,11 @@
       return;
     GamestateManager::update();
-//     COUT(5) << "Server: one gamestate update complete, goig to sendGameState" << std::endl;
-    //std::cout << "updated gamestate, sending it" << std::endl;
+//     orxout(verbose_more, context::network) << "Server: one gamestate update complete, goig to sendGameState" << endl;
+    //orxout(verbose_more, context::network) << "updated gamestate, sending it" << endl;
     //if(clients->getGamestateID()!=GAMESTATEID_INITIAL)
     sendGameStates();
     sendObjectDeletes();
-//     COUT(5) << "Server: one sendGameState turn complete, repeat in next tick" << std::endl;
-    //std::cout << "sent gamestate" << std::endl;
+//     orxout(verbose_more, context::network) << "Server: one sendGameState turn complete, repeat in next tick" << endl;
+    //orxout(verbose_more, context::network) << "sent gamestate" << endl;
   }
 
@@ -305,9 +247,9 @@
       return true;  //everything ok (no deletes this tick)
     }
-//     COUT(3) << "sending DeleteObjects" << std::endl;
+//     orxout(verbose, context::network) << "sending DeleteObjects" << endl;
 //     while(temp != NULL){
 //       if( !(temp->getSynched()) )
 //       {
-//         COUT(5) << "Server: not sending gamestate" << std::endl;
+//         orxout(verbose_more, context::network) << "Server: not sending gamestate" << endl;
 //         temp=temp->next();
 //         continue;
@@ -318,5 +260,5 @@
     del->setPeerID(NETWORK_PEER_ID_BROADCAST);
     if ( !del->send( static_cast<Host*>(this) ) )
-      COUT(3) << "Server: could not broadcast deleteObjects packet" << std::endl;
+      orxout(internal_warning, context::network) << "Server: could not broadcast deleteObjects packet" << endl;
 //       temp=temp->next();
       // gs gets automatically deleted by enet callback
@@ -330,10 +272,10 @@
   {
 //     static unsigned int newid=1;
-// 
-//     COUT(2) << "Server: adding client" << std::endl;
+//
+//     orxout(internal_info, context::network) << "Server: adding client" << endl;
 //     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
 //     if(!temp)
 //     {
-//       COUT(2) << "Server: could not add client" << std::endl;
+//       orxout(internal_warning, context::network) << "Server: could not add client" << endl;
 //     }
 //     temp->setID(newid);
@@ -347,5 +289,5 @@
 //     ++newid;
 
-    COUT(3) << "Server: added client id: " << peerID << std::endl;
+    orxout(internal_info, context::network) << "Server: added client id: " << peerID << endl;
     createClient(peerID);
 }
@@ -353,5 +295,5 @@
   void Server::removePeer(uint32_t peerID)
   {
-    COUT(4) << "removing client from list" << std::endl;
+    orxout(verbose, context::network) << "removing client from list" << endl;
 //     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
 //     if(!client)
@@ -375,5 +317,5 @@
 //     }
   }
-  
+
   void Server::processPacket(packet::Packet* packet)
   {
@@ -395,8 +337,8 @@
 //     if(!temp)
 //     {
-//       COUT(2) << "Server. could not create client with id: " << clientID << std::endl;
+//       orxout(internal_error, context::network) << "Server. could not create client with id: " << clientID << endl;
 //       return false;
 //     }
-//     COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
+//     orxout(verbose, context::network) << "Con.Man: creating client id: " << temp->getID() << endl;
 
     // synchronise class ids
@@ -411,6 +353,6 @@
 //     temp->setSynched(true);
     GamestateManager::setSynched(clientID);
-    
-    COUT(4) << "sending welcome" << std::endl;
+
+    orxout(verbose, context::network) << "sending welcome" << endl;
     packet::Welcome *w = new packet::Welcome(clientID);
     w->setPeerID(clientID);
@@ -438,31 +380,50 @@
   }
 
-  bool Server::chat(const std::string& message)
-  {
-      return this->sendChat(message, Host::getPlayerID());
-  }
-
-  bool Server::broadcast(const std::string& message)
-  {
-      return this->sendChat(message, NETWORK_PEER_ID_BROADCAST);
-  }
-
-  bool Server::sendChat(const std::string& message, unsigned int clientID)
-  {
-//     ClientInformation *temp = ClientInformation::getBegin();
-    packet::Chat *chat;
-//     while(temp)
-    {
-      chat = new packet::Chat(message, clientID);
-      chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
-      chat->send( static_cast<Host*>(this) );
-//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
-//       temp = temp->next();
-    }
-//    COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl;
-    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-      it->incomingChat(message, clientID);
-
-    return true;
+  /**
+   * @brief Sends a chat message to the given target ID.
+   * @param message message to be sent
+   * @param sourceID the ID of the sender
+   * @param targetID the ID of the receiver
+   */
+  void Server::doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+    // check if the target exists. just ignore the message otherwise
+    if (!this->isValidTarget(targetID)) // TODO: remove this if an invalid clientIDs don't trigger assertions anymore
+      return;
+
+    // send the message to the target
+    packet::Chat* packet = new packet::Chat(message, sourceID, targetID);
+    packet->setPeerID(targetID);
+    packet->send( static_cast<Host*>(this) );
+
+    // if the target is (or includes) this host as well, call the parent function which passes the message to the listeners
+    if (targetID == NETWORK_PEER_ID_BROADCAST || targetID == Host::getPlayerID())
+      Host::doReceiveChat(message, sourceID, targetID);
+  }
+
+  /**
+   * @brief Gets called if a packet::Chat packet is received. Forwards the packet to the target
+   * and calls the parent function if necessary.
+   */
+  void Server::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+      this->doSendChat(message, sourceID, targetID);
+  }
+
+  /**
+   * @brief Returns true if the target ID is in the list of clients (or if it
+   * corresponds to the broadcast or the server ID).
+   */
+  bool Server::isValidTarget(unsigned int targetID)
+  {
+    if (targetID == NETWORK_PEER_ID_BROADCAST || targetID == NETWORK_PEER_ID_SERVER)
+      return true;
+
+    std::vector<uint32_t>::iterator it;
+    for( it=this->clientIDs_.begin(); it!=this->clientIDs_.end(); ++it )
+      if( *it == targetID )
+        return true;
+
+    return false;
   }
 
@@ -476,5 +437,5 @@
     }
     assert(failures<10);
-    COUT(4) << "syncClassid:\tall synchClassID packets have been sent" << std::endl;
+    orxout(verbose, context::network) << "syncClassid:\tall synchClassID packets have been sent" << endl;
   }
 
Index: code/trunk/src/libraries/network/Server.h
===================================================================
--- code/trunk/src/libraries/network/Server.h	(revision 8857)
+++ code/trunk/src/libraries/network/Server.h	(revision 8858)
@@ -42,6 +42,4 @@
 #include "LANDiscoverable.h"
 #include "WANDiscoverable.h"
-// #include "MasterServerComm.h"
-// #include "MasterServerProtocol.h"
 
 
@@ -61,12 +59,6 @@
     ~Server();
 
-    /* helpers */
-    void helper_ConnectToMasterserver();
-    void helper_HandleMasterServerRequests();
-    int replyhandler( char *addr, ENetEvent *ev );
-
     void open();
     void close();
-    bool processChat(const std::string& message, unsigned int playerID);
     void queuePacket(ENetPacket *packet, int clientID, uint8_t channelID);
     virtual bool sendPacket( packet::Packet* packet ){ return packet->send( static_cast<Host*>(this) ); }
@@ -89,7 +81,7 @@
     bool sendGameStates();
     bool sendObjectDeletes();
-    virtual bool chat(const std::string& message);
-    virtual bool broadcast(const std::string& message);
-    bool sendChat(const std::string& message, unsigned int clientID);
+    bool isValidTarget(unsigned int targetID);
+    virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
+    virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
     void syncClassid(unsigned int clientID);
 
Index: code/trunk/src/libraries/network/ServerConnection.cc
===================================================================
--- code/trunk/src/libraries/network/ServerConnection.cc	(revision 8857)
+++ code/trunk/src/libraries/network/ServerConnection.cc	(revision 8858)
@@ -34,5 +34,5 @@
 #include <enet/enet.h>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include <util/Sleep.h>
 // #include "ClientInformation.h"
@@ -61,5 +61,5 @@
   {
     if (enet_address_set_host (this->bindAddress_, bindAddress.c_str()) < 0)
-        COUT(1) << "Error: Could not resolve \"" << bindAddress << "\"." << std::endl;
+        orxout(internal_error, context::network) << "Could not resolve \"" << bindAddress << "\"." << endl;
   }
 
@@ -75,5 +75,5 @@
     if ( this->host_ == NULL )
     {
-        COUT(1) << "ServerConnection: host_ == NULL" << std::endl;
+        orxout(internal_error, context::network) << "ServerConnection: host_ == NULL" << endl;
         return false;
     }
@@ -83,9 +83,9 @@
     assert( this->host_->socket4 != ENET_SOCKET_NULL || this->host_->socket6 != ENET_SOCKET_NULL );
     if (this->host_->socket4 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv4 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv4 Socket failed." << endl;
     else if (this->host_->socket6 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv6 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv6 Socket failed." << endl;
     else
-        COUT(3) << "Info: Using IPv4 and IPv6 Sockets." << std::endl;
+        orxout(internal_info, context::network) << "Using IPv4 and IPv6 Sockets." << endl;
     
     // start communication thread
@@ -114,5 +114,5 @@
 //       ClientInformation *temp = ClientInformation::findClient(clientID);
 //       if(!temp){
-//         COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
+//         orxout(internal_warning, context::network) << "C.Man: addPacket findClient failed" << endl;
 //       }
       Connection::addPacket(packet, clientID, channelID);
Index: code/trunk/src/libraries/network/TrafficControl.cc
===================================================================
--- code/trunk/src/libraries/network/TrafficControl.cc	(revision 8857)
+++ code/trunk/src/libraries/network/TrafficControl.cc	(revision 8858)
@@ -287,7 +287,7 @@
   {
     std::list<obj>::iterator it;
-    COUT(0) << "=========== Objectlist ===========" << endl;
+    orxout(debug_output, context::network) << "=========== Objectlist ===========" << endl;
     for( it=list.begin(); it!=list.end(); it++)
-      COUT(0) << "ObjectID: " << it->objID << " creatorID: " << it->objCreatorID << " Priority: " << clientListPerm_[clientID][it->objID].objValuePerm + clientListPerm_[clientID][it->objID].objValueSched << " size: " << it->objSize << endl;
+      orxout(debug_output, context::network) << "ObjectID: " << it->objID << " creatorID: " << it->objCreatorID << " Priority: " << clientListPerm_[clientID][it->objID].objValuePerm + clientListPerm_[clientID][it->objID].objValueSched << " size: " << it->objSize << endl;
   }
 
Index: code/trunk/src/libraries/network/WANDiscoverable.cc
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.cc	(revision 8857)
+++ code/trunk/src/libraries/network/WANDiscoverable.cc	(revision 8858)
@@ -21,8 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau (original)
+ *      Sandro 'smerkli' Merkli
  *   Co-authors:
- *      Sandro 'smerkli' Merkli (adaptions to WAN)
- *      ...
+ *      Oliver Scheuss (original)
  *
  */
@@ -44,5 +43,5 @@
   {
     /* debugging output */
-    COUT(4) << "Creating WANDiscoverable.\n";
+    orxout(verbose, context::master_server) << "Creating WANDiscoverable." << endl;
   
     /* register object in orxonox */
@@ -91,5 +90,5 @@
     if( msc.initialize() )
     {
-      COUT(2) << "Error: could not initialize master server communications!\n";
+      orxout(internal_error, context::master_server) << "Could not initialize master server communications!" << endl;
       return false;
     }
@@ -98,11 +97,11 @@
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
     {
-      COUT(2) << "Error: could not connect to master server at " 
-                 << this->msaddress << std::endl;
+      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+                 << this->msaddress << endl;
       return false;
     }
                  
     /* debugging output */
-    COUT(4) << "Initialization of WANDiscoverable complete.\n";
+    orxout(verbose, context::master_server) << "Initialization of WANDiscoverable complete." << endl;
     
     
Index: code/trunk/src/libraries/network/WANDiscoverable.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.h	(revision 8857)
+++ code/trunk/src/libraries/network/WANDiscoverable.h	(revision 8858)
@@ -19,6 +19,8 @@
  *   Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- *   Author: Fabian 'x3n' Landau (original) Co-authors: Sandro 'smerkli' Merkli
- *   (copied and adapted to WAN)
+ *   Author:
+ *      Sandro 'smerkli' Merkli
+ *   Co-authors:
+ *      Oliver Scheuss (original)
  *
  */
Index: code/trunk/src/libraries/network/WANDiscovery.cc
===================================================================
--- code/trunk/src/libraries/network/WANDiscovery.cc	(revision 8857)
+++ code/trunk/src/libraries/network/WANDiscovery.cc	(revision 8858)
@@ -21,8 +21,7 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau (original)
+ *      Sandro 'smerkli' Merkli
  *   Co-authors:
- *      Sandro 'smerkli' Merkli (adaptions to WAN)
- *      ...
+ *      Oliver Scheuss (original)
  *
  */
@@ -33,5 +32,4 @@
 #include <cstring>
 
-#include "util/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
 
@@ -39,11 +37,8 @@
 namespace orxonox
 {
-  ManageScopedSingleton(WANDiscovery, ScopeID::Graphics, true);
-
-
   WANDiscovery::WANDiscovery()
   {
     /* debugging output */
-    COUT(4) << "Creating WANDiscovery.\n";
+    orxout(verbose, context::master_server) << "Creating WANDiscovery." << endl;
   
     /* register object in orxonox */
@@ -55,13 +50,13 @@
     /* initialize it and see if it worked */
     if( msc.initialize() )
-      COUT(2) << "Error: could not initialize master server communications!\n";
+      orxout(internal_error, context::master_server) << "Could not initialize master server communications!" << endl;
 
     /* connect and see if it worked */
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
-      COUT(2) << "Error: could not connect to master server at " 
-        << this->msaddress << std::endl;
+      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+        << this->msaddress << endl;
 
     /* debugging output */
-    COUT(4) << "Initialization of WANDiscovery complete.\n";
+    orxout(verbose, context::master_server) << "Initialization of WANDiscovery complete." << endl;
   }
 
@@ -81,9 +76,9 @@
 
   /* callback for the network reply poller */
-  int rhandler( char *addr, ENetEvent *ev )
+  int WANDiscovery::rhandler( char *addr, ENetEvent *ev )
   { 
     /* error recognition */
     if( !ev || !ev->packet || !ev->packet->data )
-    { COUT(2) << "Bad arguments received in WANDiscovery's reply handler.\n";
+    { orxout(internal_warning, context::master_server) << "Bad arguments received in WANDiscovery's reply handler." << endl;
       return 0;
     }
@@ -104,5 +99,5 @@
 
       /* add to list */
-      WANDiscovery::getInstance().servers_.push_back( toadd );
+      this->servers_.push_back( toadd );
     }
     else if( !strncmp( (char*)ev->packet->data, MSPROTO_SERVERLIST_END,
@@ -133,5 +128,5 @@
     {
       /* poll for reply and act according to what was received */
-      switch( this->msc.pollForReply( rhandler, 500 ) )
+      switch( this->msc.pollForReply( this, 500 ) )
       { case 0: /* no event occured, decrease timeout */
           --i; break;
Index: code/trunk/src/libraries/network/WANDiscovery.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscovery.h	(revision 8857)
+++ code/trunk/src/libraries/network/WANDiscovery.h	(revision 8858)
@@ -19,6 +19,8 @@
  *   Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- *   Author: Fabian 'x3n' Landau (original) Co-authors: Sandro 'smerkli' Merkli
- *   (copied and adapted to WAN)
+ *   Author:
+ *      Sandro 'smerkli' Merkli
+ *   Co-authors:
+ *      Oliver Scheuss (original)
  *
  */
@@ -30,5 +32,4 @@
 #include "packet/ServerInformation.h"
 #include "core/ConfigFileManager.h"
-#include "util/Singleton.h"
 #include "core/OrxonoxClass.h"
 #include "core/ConfigValueIncludes.h"
@@ -47,10 +48,9 @@
   class _NetworkExport WANDiscovery
 // tolua_end
-    : public Singleton<WANDiscovery>, public OrxonoxClass
+    : public OrxonoxClass
   { // tolua_export
-    friend class Singleton<WANDiscovery>;
     public:
       /** constructor */
-      WANDiscovery();
+      WANDiscovery(); // tolua_export
 
       /** destructor */
@@ -81,10 +81,4 @@
       std::string getServerListItemIP( unsigned int index ); // tolua_export
 
-      /** \return an instance of WANDiscovery
-       * 
-       * Create and return an instance of WANDiscovery.
-       */
-      static WANDiscovery& getInstance() { return Singleton<WANDiscovery>::getInstance(); } // tolua_export
-    
       /* todo: might make this private and use getter/setter methods
        * at some later time. 
@@ -98,9 +92,8 @@
       /** Master server communications object */
       MasterServerComm msc;
+
+      int rhandler( char *addr, ENetEvent *ev );
       
     private:
-      /** Singleton pointer */
-      static WANDiscovery* singletonPtr_s;
-
       /** master server address */
       std::string msaddress;
Index: code/trunk/src/libraries/network/packet/Acknowledgement.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Acknowledgement.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/Acknowledgement.cc	(revision 8858)
@@ -29,5 +29,5 @@
 #include "Acknowledgement.h"
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "network/GamestateHandler.h"
 #include "network/Host.h"
@@ -64,5 +64,5 @@
 
 bool Acknowledgement::process(orxonox::Host* host){
-  COUT(5) << "processing ACK with ID: " << getAckID() << endl;
+  orxout(verbose_more, context::packets) << "processing ACK with ID: " << getAckID() << endl;
   bool b = host->ackGamestate(getAckID(), peerID_);
   delete this;
Index: code/trunk/src/libraries/network/packet/Chat.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Chat.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/Chat.cc	(revision 8858)
@@ -39,10 +39,11 @@
 
 /* Some lengths */
-#define   _PACKETID         0
-const int _PLAYERID     =   _PACKETID + sizeof(Type::Value);
-#define   _MESSAGELENGTH    _PLAYERID + sizeof(uint32_t)
-#define   _MESSAGE          _MESSAGELENGTH + sizeof(uint32_t)
+#define _PACKETID         0
+#define _SOURCEID         _PACKETID + sizeof(Type::Value)
+#define _TARGETID         _SOURCEID + sizeof(uint32_t)
+#define _MESSAGELENGTH    _TARGETID + sizeof(uint32_t)
+#define _MESSAGE          _MESSAGELENGTH + sizeof(uint32_t)
 
-Chat::Chat( const std::string& message, unsigned int playerID )
+Chat::Chat( const std::string& message, unsigned int sourceID, unsigned int targetID )
  : Packet()
 {
@@ -57,5 +58,6 @@
 
   *(Type::Value *)(data_ + _PACKETID ) = Type::Chat;
-  *(unsigned int *)(data_ + _PLAYERID ) = playerID;
+  *(unsigned int *)(data_ + _SOURCEID ) = sourceID;
+  *(unsigned int *)(data_ + _TARGETID ) = targetID;
   *(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_;
 
@@ -81,7 +83,7 @@
 
 bool Chat::process(orxonox::Host* host){
-  bool b = host->incomingChat(std::string((const char*)data_+_MESSAGE), *(uint32_t *)(data_+_PLAYERID));
+  host->doReceiveChat(std::string((const char*)data_+_MESSAGE), *(uint32_t *)(data_+_SOURCEID), *(uint32_t *)(data_+_TARGETID));
   delete this;
-  return b;
+  return true;
 }
 
Index: code/trunk/src/libraries/network/packet/Chat.h
===================================================================
--- code/trunk/src/libraries/network/packet/Chat.h	(revision 8857)
+++ code/trunk/src/libraries/network/packet/Chat.h	(revision 8858)
@@ -42,5 +42,5 @@
 public:
   /* constructors */
-  Chat( const std::string& message, unsigned int playerID );
+  Chat( const std::string& message, unsigned int sourceID, unsigned int targetID );
   Chat( uint8_t* data, unsigned int clientID );
 
Index: code/trunk/src/libraries/network/packet/ClassID.cc
===================================================================
--- code/trunk/src/libraries/network/packet/ClassID.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/ClassID.cc	(revision 8858)
@@ -92,5 +92,5 @@
   assert(tempsize==packetSize);
 
-  COUT(5) << "classid packetSize is " << packetSize << endl;
+  orxout(verbose_more, context::packets) << "classid packetSize is " << packetSize << endl;
 
 }
@@ -131,5 +131,5 @@
   Identifier::clearNetworkIDs();
 
-  COUT(4) << "=== processing classids: " << endl;
+  orxout(verbose, context::packets) << "=== processing classids: " << endl;
   std::pair<uint32_t, std::string> tempPair;
   Identifier *id;
@@ -143,7 +143,7 @@
     classname = temp+2*sizeof(uint32_t);
     id=ClassByString( std::string((const char*)classname) );
-    COUT(3) << "processing classid: " << networkID << " name: " << classname << " id: " << id << std::endl;
+    orxout(internal_info, context::packets) << "processing classid: " << networkID << " name: " << classname << " id: " << id << endl;
     if(id==NULL){
-      COUT(0) << "Received a bad classname" << endl;
+      orxout(user_error, context::packets) << "Received a bad classname" << endl;
       abort();
     }
Index: code/trunk/src/libraries/network/packet/DeleteObjects.cc
===================================================================
--- code/trunk/src/libraries/network/packet/DeleteObjects.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/DeleteObjects.cc	(revision 8858)
@@ -31,5 +31,5 @@
 
 #include <cassert>
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "network/synchronisable/Synchronisable.h"
 
@@ -62,5 +62,5 @@
   if(number==0)
     return false;
-  COUT(4) << "sending DeleteObjects: ";
+  orxout(verbose, context::packets) << "sending DeleteObjects: ";
   unsigned int size = sizeof(Type::Value) + sizeof(uint32_t)*(number+1);
   data_ = new uint8_t[size];
@@ -73,8 +73,8 @@
     unsigned int temp = Synchronisable::popDeletedObject();
     *reinterpret_cast<uint32_t*>(tdata) = temp;
-    COUT(4) << temp << ' ';
+    orxout(verbose, context::packets) << temp << ' ';
     tdata += sizeof(uint32_t);
   }
-  COUT(4) << std::endl;
+  orxout(verbose, context::packets) << endl;
   return true;
 }
@@ -90,5 +90,5 @@
   for(unsigned int i=0; i<*(unsigned int *)(data_+_QUANTITY); i++)
   {
-    COUT(4) << "deleting object with id: " << *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) << std::endl;
+    orxout(verbose, context::packets) << "deleting object with id: " << *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) << endl;
     Synchronisable::deleteObject( *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) );
   }
Index: code/trunk/src/libraries/network/packet/FunctionIDs.cc
===================================================================
--- code/trunk/src/libraries/network/packet/FunctionIDs.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/FunctionIDs.cc	(revision 8858)
@@ -34,5 +34,5 @@
 #include <string>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "core/ObjectList.h"
 #include "network/NetworkFunction.h"
@@ -88,5 +88,5 @@
   }
 
-  COUT(5) << "FunctionIDs packetSize is " << packetSize << endl;
+  orxout(verbose_more, context::packets) << "FunctionIDs packetSize is " << packetSize << endl;
 
 }
@@ -126,5 +126,5 @@
   unsigned char *functionname;
 
-  COUT(4) << "=== processing functionids: " << endl;
+  orxout(verbose, context::packets) << "=== processing functionids: " << endl;
   std::pair<uint32_t, std::string> tempPair;
   // read the total number of classes
@@ -137,5 +137,5 @@
     stringsize = *(uint32_t*)(temp+sizeof(uint32_t));
     functionname = temp+2*sizeof(uint32_t);
-    COUT(3) << "processing functionid: " << networkID << " name: " << functionname << std::endl;
+    orxout(internal_info, context::packets) << "processing functionid: " << networkID << " name: " << functionname << endl;
     NetworkFunctionBase::setNetworkID((const char*)functionname, networkID);
     temp += 2*sizeof(uint32_t) + stringsize;
Index: code/trunk/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Gamestate.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/Gamestate.cc	(revision 8858)
@@ -31,5 +31,5 @@
 #include <zlib.h>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "util/OrxAssert.h"
 #include "core/GameMode.h"
@@ -108,5 +108,5 @@
   uint32_t size = calcGamestateSize(id, mode);
 
-  COUT(5) << "G.ST.Man: producing gamestate with id: " << id << std::endl;
+  orxout(verbose_more, context::packets) << "G.ST.Man: producing gamestate with id: " << id << endl;
   if(size==0)
     return false;
@@ -114,5 +114,5 @@
   if(!data_)
   {
-    COUT(2) << "GameStateManager: could not allocate memory" << std::endl;
+    orxout(internal_warning, context::packets) << "GameStateManager: could not allocate memory" << endl;
     return false;
   }
@@ -139,5 +139,5 @@
       assert(0); // if we don't use multithreading this part shouldn't be neccessary
       // start allocate additional memory
-      COUT(3) << "Gamestate: need additional memory" << std::endl;
+      orxout(internal_info, context::packets) << "Gamestate: need additional memory" << endl;
       ObjectList<Synchronisable>::iterator temp = it;
       uint32_t addsize=tempsize;
@@ -167,6 +167,6 @@
   //stop write gamestate header
 
-  COUT(5) << "Gamestate: Gamestate size: " << currentsize << std::endl;
-  COUT(5) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << std::endl;
+  orxout(verbose_more, context::packets) << "Gamestate: Gamestate size: " << currentsize << endl;
+  orxout(verbose_more, context::packets) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << endl;
   return true;
 }
@@ -175,5 +175,5 @@
 bool Gamestate::spreadData(uint8_t mode)
 {
-  COUT(5) << "processing gamestate with id " << header_.getID() << endl;
+  orxout(verbose_more, context::packets) << "processing gamestate with id " << header_.getID() << endl;
   assert(data_);
   assert(!header_.isCompressed());
@@ -195,5 +195,5 @@
       else
       {
-//         COUT(4) << "not creating object of classid " << objectheader.getClassID() << endl;
+//         orxout(verbose, context::packets) << "not creating object of classid " << objectheader.getClassID() << endl;
         mem += objectheader.getDataSize() + ( objectheader.isDiffed() ? SynchronisableHeaderLight::getSize() : SynchronisableHeader::getSize() );
       }
@@ -201,5 +201,5 @@
     else
     {
-//       COUT(4) << "updating object of classid " << objectheader.getClassID() << endl;
+//       orxout(verbose, context::packets) << "updating object of classid " << objectheader.getClassID() << endl;
       OrxVerify(s->updateData(mem, mode), "ERROR: could not update Synchronisable with Gamestate data");
     }
@@ -219,7 +219,7 @@
         if (it->objectMode_ != 0x0)
         {
-          COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
-          COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
-          COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
+          orxout(user_error, context::packets) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << endl;
+          orxout(user_error, context::packets) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << endl;
+          orxout(user_error, context::packets) << "Objects class: " << it->getIdentifier()->getName() << endl;
           assert(false);
         }
@@ -232,7 +232,7 @@
           if (it->getObjectID() == *it2)
           {
-            COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
-                    << "Are you sure you don't create a Sychnronisable objcect with 'new' \
-                        that doesn't have objectMode = 0x0?" << std::endl;
+            orxout(user_error, context::packets) << "Found duplicate objectIDs on the client!" << endl
+                                                 << "Are you sure you don't create a Sychnronisable objcect with 'new' \
+                                                     that doesn't have objectMode = 0x0?" << endl;
             assert(false);
           }
@@ -293,8 +293,8 @@
   switch ( retval )
   {
-    case Z_OK: COUT(5) << "G.St.Man: compress: successfully compressed" << std::endl; break;
-    case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl; return false;
-    case Z_BUF_ERROR: COUT(2) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << std::endl; return false;
-    case Z_DATA_ERROR: COUT(2) << "G.St.Man: compress: data corrupted in gamestate.compress" << std::endl; return false;
+    case Z_OK: orxout(verbose_more, context::packets) << "G.St.Man: compress: successfully compressed" << endl; break;
+    case Z_MEM_ERROR: orxout(internal_error, context::packets) << "G.St.Man: compress: not enough memory available in gamestate.compress" << endl; return false;
+    case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << endl; return false;
+    case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: data corrupted in gamestate.compress" << endl; return false;
   }
 
@@ -310,5 +310,5 @@
   header_.setCompSize( buffer );
   header_.setCompressed( true );
-  COUT(4) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << std::endl;
+  orxout(verbose, context::packets) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << endl;
   return true;
 }
@@ -319,5 +319,5 @@
   assert(data_);
   assert(header_.isCompressed());
-  COUT(4) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << std::endl;
+  orxout(verbose, context::packets) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << endl;
   uint32_t datasize = header_.getDataSize();
   uint32_t compsize = header_.getCompSize();
@@ -333,8 +333,8 @@
   switch ( retval )
   {
-    case Z_OK: COUT(5) << "successfully decompressed" << std::endl; break;
-    case Z_MEM_ERROR: COUT(1) << "not enough memory available" << std::endl; return false;
-    case Z_BUF_ERROR: COUT(2) << "not enough memory available in the buffer" << std::endl; return false;
-    case Z_DATA_ERROR: COUT(2) << "data corrupted (zlib)" << std::endl; return false;
+    case Z_OK: orxout(verbose_more, context::packets) << "successfully decompressed" << endl; break;
+    case Z_MEM_ERROR: orxout(internal_error, context::packets) << "not enough memory available" << endl; return false;
+    case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "not enough memory available in the buffer" << endl; return false;
+    case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "data corrupted (zlib)" << endl; return false;
   }
 
@@ -375,5 +375,5 @@
   if( memcmp( origDataPtr+objectOffset, baseDataPtr+objectOffset, objectHeader.getDataSize()) == 0 )
   {
-//     COUT(4) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl;
+//     orxout(verbose, context::packets) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl;
     origDataPtr += objectOffset + objectHeader.getDataSize(); // skip the whole object
     baseDataPtr += objectOffset + objectHeader.getDataSize();
@@ -431,5 +431,5 @@
 inline void /*Gamestate::*/copyObject( uint8_t*& newData, uint8_t*& origData, uint8_t*& baseData, SynchronisableHeader& objectHeader, std::vector<uint32_t>::iterator& sizes )
 {
-  //       COUT(4) << "docopy" << endl;
+  //       orxout(verbose, context::packets) << "docopy" << endl;
   // Just copy over the whole Object
   memcpy( newData, origData, objectHeader.getDataSize()+SynchronisableHeader::getSize() );
@@ -440,13 +440,13 @@
 //   SynchronisableHeader baseHeader( baseData );
 //   baseData += baseHeader.getDataSize()+SynchronisableHeader::getSize();
-  //       COUT(4) << "copy " << h.getObjectID() << endl;
-  //       COUT(4) << "copy " << h.getObjectID() << ":";
+  //       orxout(verbose, context::packets) << "copy " << h.getObjectID() << endl;
+  //       orxout(verbose, context::packets) << "copy " << h.getObjectID() << ":";
   sizes += Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables();
 //   for( unsigned int i = 0; i < Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables(); ++i )
 //   {
-//     //         COUT(4) << " " << *sizes;
+//     //         orxout(verbose, context::packets) << " " << *sizes;
 //     ++sizes;
 //   }
-    //       COUT(4) << endl;
+    //       orxout(verbose, context::packets) << endl;
 }
 
@@ -541,5 +541,5 @@
       if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() )
       {
-//         COUT(4) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
         diffedObject = true;
@@ -547,5 +547,5 @@
       else
       {
-//         COUT(4) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
         assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd);
@@ -565,5 +565,5 @@
         if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() )
         {
-//           COUT(4) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//           orxout(verbose, context::packets) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
           diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
           diffedObject = true;
@@ -571,5 +571,5 @@
         else
         {
-//           COUT(4) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//           orxout(verbose, context::packets) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
           copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
           assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd);
@@ -578,5 +578,5 @@
       else
       {
-//         COUT(4) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         assert(baseDataPtr == oldBaseDataPtr);
         copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
@@ -718,8 +718,8 @@
   //copy in the zeros
 //   std::list<obj>::iterator itt;
-//   COUT(0) << "myvector contains:";
+//   orxout() << "myvector contains:";
 //   for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
-//     COUT(0) << " " << (*itt).objID;
-//   COUT(0) << endl;
+//     orxout() << " " << (*itt).objID;
+//   orxout() << endl;
   for(it=dataVector_.begin(); it!=dataVector_.end();){
     SynchronisableHeader oldobjectheader(origdata);
@@ -771,5 +771,5 @@
     nrOfVariables += it->getNrOfVariables();
   }
-//   COUT(0) << "allocating " << nrOfVariables << " ints" << endl;
+//   orxout() << "allocating " << nrOfVariables << " ints" << endl;
   this->sizes_.reserve(nrOfVariables);
   return size;
Index: code/trunk/src/libraries/network/packet/Packet.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Packet.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/Packet.cc	(revision 8858)
@@ -37,5 +37,5 @@
 #include <boost/thread/mutex.hpp>
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "Acknowledgement.h"
 #include "Chat.h"
@@ -192,37 +192,37 @@
 //     peerID = NETWORK_PEER_ID_SERVER;
   Packet *p = 0;
-//   COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl;
+//   orxout(verbose_ultra, context::packets) << "packet type: " << *(Type::Value *)&data[_PACKETID] << endl;
   switch( *(Type::Value *)(data + _PACKETID) )
   {
     case Type::Acknowledgement:
-//       COUT(5) << "ack" << std::endl;
+//       orxout(verbose_more, context::packets) << "ack" << endl;
     p = new Acknowledgement( data, peerID );
       break;
     case Type::Chat:
-//       COUT(5) << "chat" << std::endl;
+//       orxout(verbose_more, context::packets) << "chat" << endl;
       p = new Chat( data, peerID );
       break;
     case Type::ClassID:
-//       COUT(5) << "classid" << std::endl;
+//       orxout(verbose_more, context::packets) << "classid" << endl;
       p = new ClassID( data, peerID );
       break;
     case Type::Gamestate:
-//       COUT(5) << "gamestate" << std::endl;
+//       orxout(verbose_more, context::packets) << "gamestate" << endl;
       p = new Gamestate( data, peerID );
       break;
     case Type::Welcome:
-//       COUT(5) << "welcome" << std::endl;
+//       orxout(verbose_more, context::packets) << "welcome" << endl;
       p = new Welcome( data, peerID );
       break;
     case Type::DeleteObjects:
-//       COUT(5) << "deleteobjects" << std::endl;
+//       orxout(verbose_more, context::packets) << "deleteobjects" << endl;
       p = new DeleteObjects( data, peerID );
       break;
     case Type::FunctionCalls:
-//       COUT(5) << "functionCalls" << std::endl;
+//       orxout(verbose_more, context::packets) << "functionCalls" << endl;
       p = new FunctionCalls( data, peerID );
       break;
     case Type::FunctionIDs:
-//       COUT(5) << "functionIDs" << std::endl;
+//       orxout(verbose_more, context::packets) << "functionIDs" << endl;
       p = new FunctionIDs( data, peerID );
       break;
@@ -255,5 +255,5 @@
   packetMap_.erase(it);
   Packet::packetMapMutex_.unlock();
-//   COUT(6) << "PacketMap size: " << packetMap_.size() << std::endl;
+//   orxout(verbose_ultra, context::packets) << "PacketMap size: " << packetMap_.size() << endl;
 }
 
Index: code/trunk/src/libraries/network/packet/Welcome.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Welcome.cc	(revision 8857)
+++ code/trunk/src/libraries/network/packet/Welcome.cc	(revision 8858)
@@ -32,5 +32,5 @@
 
 #include <cassert>
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "network/Host.h"
 #include "network/synchronisable/Synchronisable.h"
@@ -78,5 +78,5 @@
   assert(*(uint32_t *)(data_ + _ENDIANTEST ) == 0xFEDC4321);
   host->setClientID(clientID);
-  COUT(3) << "Welcome set clientId: " << clientID << endl;
+  orxout(internal_info, context::packets) << "Welcome set clientId: " << clientID << endl;
   Synchronisable::setClient(true);
   delete this;
Index: code/trunk/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.cc	(revision 8857)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.cc	(revision 8858)
@@ -130,5 +130,5 @@
 //     assert( !header.isDiffed() );
 
-    COUT(4) << "fabricating object with id: " << header.getObjectID() << std::endl;
+    orxout(verbose, context::network) << "fabricating object with id: " << header.getObjectID() << endl;
 
     Identifier* id = ClassByID(header.getClassID());
@@ -136,7 +136,7 @@
     {
         for(int i = 0; i<160; i++)
-            COUT(0) << "classid: " << i << " identifier: " << ClassByID(i) << endl;
-        COUT(0) << "Assertion failed: id" << std::endl;
-        COUT(0) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << std::endl;
+            orxout(user_error, context::network) << "classid: " << i << " identifier: " << ClassByID(i) << endl;
+        orxout(user_error, context::network) << "Assertion failed: id" << endl;
+        orxout(user_error, context::network) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << endl;
         abort();
     }
@@ -168,5 +168,5 @@
       bo->setLevel(creator->getLevel());          // Note: this ensures that the level is known on the client for child objects of the scene (and the scene itself)
     //assert(no->classID_ == header.getClassID());
-    COUT(4) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << std::endl;
+    orxout(verbose, context::network) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << endl;
           // update data and create object/entity...
     bool b = no->updateData(mem, mode, true);
@@ -242,5 +242,5 @@
     uint8_t* oldmem = mem;
     if (this->classID_==0)
-      COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
+      orxout(internal_info, context::network) << "classid 0 " << this->getIdentifier()->getName() << endl;
 #endif
 
@@ -258,11 +258,11 @@
     // end copy header
 
-    CCOUT(5) << "getting data from objectID_: " << objectID_ << ", classID_: " << classID_ << std::endl;
-//     COUT(4) << "objectid: " << this->objectID_ << ":";
+    orxout(verbose_more, context::network) << "getting data from objectID_: " << objectID_ << ", classID_: " << classID_ << endl;
+//     orxout(verbose, context::network) << "objectid: " << this->objectID_ << ":";
     // copy to location
     for(i=syncList_.begin(); i!=syncList_.end(); ++i)
     {
       uint32_t varsize = (*i)->getData( mem, mode );
-//       COUT(4) << " " << varsize;
+//       orxout(verbose, context::network) << " " << varsize;
       tempsize += varsize;
       sizes.push_back(varsize);
@@ -271,5 +271,5 @@
     }
     assert(tempsize!=0);  // if this happens an empty object (with no variables) would be transmitted
-//     COUT(4) << endl;
+//     orxout(verbose, context::network) << endl;
 
     header.setObjectID( this->objectID_ );
@@ -305,6 +305,6 @@
     if(syncList_.empty())
     {
+      orxout(internal_warning, context::network) << "Synchronisable::updateData syncList_ is empty" << endl;
       assert(0);
-      COUT(2) << "Synchronisable::updateData syncList_ is empty" << std::endl;
       return false;
     }
@@ -326,5 +326,5 @@
     }
 
-    //COUT(5) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << std::endl;
+    //orxout(verbose_more, context::network) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << endl;
     if( !syncHeaderLight.isDiffed() )
     {
@@ -344,9 +344,9 @@
     {
       mem += SynchronisableHeaderLight::getSize();
-//       COUT(0) << "objectID: " << this->objectID_ << endl;
+//       orxout(debug_output, context::network) << "objectID: " << this->objectID_ << endl;
       while( mem < data+syncHeaderLight.getDataSize()+SynchronisableHeaderLight::getSize() )
       {
         VariableID varID = *(VariableID*)mem;
-//         COUT(0) << "varID: " << varID << endl;
+//         orxout(debug_output, context::network) << "varID: " << varID << endl;
         assert( varID < syncList_.size() );
         mem += sizeof(VariableID);
Index: code/trunk/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.h	(revision 8857)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.h	(revision 8858)
@@ -232,5 +232,5 @@
         it++;
     }
-    COUT(1) << "Tried to unregister not registered variable" << endl;
+    orxout(internal_error, context::network) << "Tried to unregister not registered variable" << endl;
     assert(false); //if we reach this point something went wrong:
     // the variable has not been registered before
Index: code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h	(revision 8857)
+++ code/trunk/src/libraries/network/synchronisable/SynchronisableVariable.h	(revision 8858)
@@ -202,5 +202,5 @@
         if ( *static_cast<uint8_t*>(mem) != this->varReference_ )
         { // wrong reference number, so discard the data
-//           COUT(0) << "discharding data" << endl;
+//           orxout(debug_output, context::network) << "discharding data" << endl;
           mem += getSize( mode ); // SynchronisableVariableBidirectional::getSize returns size of variable + reference
           return;
Index: code/trunk/src/libraries/tools/BillboardSet.cc
===================================================================
--- code/trunk/src/libraries/tools/BillboardSet.cc	(revision 8857)
+++ code/trunk/src/libraries/tools/BillboardSet.cc	(revision 8858)
@@ -80,5 +80,5 @@
         catch (...)
         {
-            COUT(1) << "Error: Couln't load billboard \"" << file << '"' << std::endl;
+            orxout(internal_error) << "Couldn't load billboard \"" << file << '"' << endl;
             this->billboardSet_ = 0;
         }
@@ -103,5 +103,5 @@
         catch (...)
         {
-            COUT(1) << "Error: Couln't load billboard \"" << file << '"' << std::endl;
+            orxout(internal_error) << "Couldn't load billboard \"" << file << '"' << endl;
             this->billboardSet_ = 0;
         }
Index: code/trunk/src/libraries/tools/Mesh.cc
===================================================================
--- code/trunk/src/libraries/tools/Mesh.cc	(revision 8857)
+++ code/trunk/src/libraries/tools/Mesh.cc	(revision 8858)
@@ -72,5 +72,5 @@
             catch (...)
             {
-                COUT(1) << "Error: Couln't load mesh \"" << meshsource << '"' << std::endl;
+                orxout(internal_error) << "Couldn't load mesh \"" << meshsource << '"' << endl;
                 this->entity_ = 0;
             }
Index: code/trunk/src/libraries/tools/ParticleInterface.cc
===================================================================
--- code/trunk/src/libraries/tools/ParticleInterface.cc	(revision 8857)
+++ code/trunk/src/libraries/tools/ParticleInterface.cc	(revision 8858)
@@ -78,5 +78,5 @@
             catch (...)
             {
-                COUT(1) << "Error: Couln't load particle system \"" << templateName << '"' << std::endl;
+                orxout(internal_error) << "Couldn't load particle system \"" << templateName << '"' << endl;
                 this->particleSystem_ = 0;
             }
Index: code/trunk/src/libraries/tools/ResourceCollection.cc
===================================================================
--- code/trunk/src/libraries/tools/ResourceCollection.cc	(revision 8857)
+++ code/trunk/src/libraries/tools/ResourceCollection.cc	(revision 8858)
@@ -62,5 +62,5 @@
         if (resourceGroup.empty())
         {
-            COUT(2) << "Warning: \"\" is not a valid resource group." << std::endl;
+            orxout(internal_warning) << "\"\" is not a valid resource group." << endl;
             return;
         }
Index: code/trunk/src/libraries/tools/ResourceLocation.cc
===================================================================
--- code/trunk/src/libraries/tools/ResourceLocation.cc	(revision 8857)
+++ code/trunk/src/libraries/tools/ResourceLocation.cc	(revision 8858)
@@ -80,5 +80,5 @@
         else
         {
-            COUT(2) << "Warning: ResourceLocation '" << this->getPath() << "' does not seem to exist" << std::endl;
+            orxout(internal_warning) << "ResourceLocation '" << this->getPath() << "' does not seem to exist" << endl;
             return;
         }
@@ -101,5 +101,5 @@
         catch (const Ogre::Exception& ex)
         {
-            COUT(1) << "Removing of a ResourceLocation failed: " << ex.what() << std::endl;
+            orxout(internal_error) << "Removing of a ResourceLocation failed: " << ex.what() << endl;
         }
     }
Index: code/trunk/src/libraries/tools/Shader.cc
===================================================================
--- code/trunk/src/libraries/tools/Shader.cc	(revision 8857)
+++ code/trunk/src/libraries/tools/Shader.cc	(revision 8858)
@@ -141,5 +141,5 @@
                 }
                 else
-                    COUT(2) << "Warning: Couldn't load compositor with name \"" << this->compositorName_ << "\"." << std::endl;
+                    orxout(internal_warning) << "Couldn't load compositor with name \"" << this->compositorName_ << "\"." << endl;
             }
             this->oldcompositorName_ = this->compositorName_;
@@ -217,8 +217,8 @@
                 }
                 else
-                    COUT(2) << "Warning: No pass " << it->pass_ << " in technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << std::endl;
+                    orxout(internal_warning) << "No pass " << it->pass_ << " in technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl;
             }
             else
-                COUT(2) << "Warning: No technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << std::endl;
+                orxout(internal_warning) << "No technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << endl;
         }
         this->parameters_.clear();
Index: code/trunk/src/libraries/tools/Timer.h
===================================================================
--- code/trunk/src/libraries/tools/Timer.h	(revision 8857)
+++ code/trunk/src/libraries/tools/Timer.h	(revision 8858)
@@ -66,5 +66,5 @@
     void MyClass::myFunction()
     {
-        COUT(0) << "Hello World" << std::endl;
+        orxout() << "Hello World" << endl;
     }
     @endcode
Index: code/trunk/src/libraries/util/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/util/CMakeLists.txt	(revision 8857)
+++ code/trunk/src/libraries/util/CMakeLists.txt	(revision 8858)
@@ -26,5 +26,4 @@
   CRC32.cc
   ExprParser.cc
-  OutputHandler.cc
   Scope.cc
   ScopedSingletonManager.cc
@@ -42,4 +41,6 @@
 )
 
+ADD_SUBDIRECTORY(output)
+
 ORXONOX_ADD_LIBRARY(util
   FIND_HEADER_FILES
Index: code/trunk/src/libraries/util/Clipboard.cc
===================================================================
--- code/trunk/src/libraries/util/Clipboard.cc	(revision 8857)
+++ code/trunk/src/libraries/util/Clipboard.cc	(revision 8858)
@@ -48,5 +48,5 @@
 #undef min
 #undef max
-#include "Debug.h"
+#include "Output.h"
 
 namespace orxonox
@@ -76,6 +76,6 @@
         catch (...)
         {
-            COUT(1) << "Error: Unable to copy the following text to the clipboard:" << std::endl;
-            COUT(1) << "       \"" << text << '"' << std::endl;
+            orxout(user_error) << "Unable to copy the following text to the clipboard:" << endl;
+            orxout(user_error) << '"' << text << '"' << endl;
         }
         return false;
@@ -104,5 +104,5 @@
         catch (...)
         {
-            COUT(1) << "Error: Unable to retrieve text from the clipboard." << std::endl;
+            orxout(user_error) << "Unable to retrieve text from the clipboard." << endl;
         }
         return "";
Index: code/trunk/src/libraries/util/Convert.h
===================================================================
--- code/trunk/src/libraries/util/Convert.h	(revision 8857)
+++ code/trunk/src/libraries/util/Convert.h	(revision 8858)
@@ -130,5 +130,5 @@
 #include <loki/TypeManip.h>
 
-#include "Debug.h"
+#include "Output.h"
 #include "ImplicitConversion.h"
 
@@ -151,6 +151,6 @@
         ORX_FORCEINLINE static bool convert(ToType* /*output*/, const FromType& /*input*/)
         {
-            COUT(2) << "Could not convert value of type " << typeid(FromType).name()
-                    << " to type " << typeid(ToType).name() << std::endl;
+            orxout(internal_warning) << "Could not convert value of type " << typeid(FromType).name()
+                                     << " to type " << typeid(ToType).name() << endl;
             return false;
         }
Index: code/trunk/src/libraries/util/Debug.h
===================================================================
--- code/trunk/src/libraries/util/Debug.h	(revision 8857)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- *   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
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @defgroup COUT COUT(x) output macro
-    @ingroup Util
-*/
-
-/**
-@file
-@ingroup COUT
-@brief
-    Handles different output-levels of errors, warnings, infos, and debug information.
-
-    The COUT(level) macro acts like @c std::cout, but the output is only performed if the given
-    level is <= the soft debug level.
-
-    There are two used values in this file:
-     - The hard debug level is used during compile time. It describes the highest allowed output level.
-     - The soft debug level is used during runtime and is the maximum of the three configurable
-       output-levels for console, log file, and in game shell.
-
-    The separation between the three devices is done by the OutputHandler.
-
-    @anchor COUTlevels
-    Possible levels are:
-     - 0: Very important output
-     - 1: Errors
-     - 2: Warnings
-     - 3: Information
-     - 4: Debug information
-     - 5: More debug information
-     - 6: Crazy debug information
-
-    Example:
-    @code
-    COUT(0) << "Very important output" << std::endl;
-    COUT(1) << "Error: Something went wrong!" << std::endl;
-    COUT(2) << "Warning: There might be a problem." << std::endl;
-    COUT(3) << "Info: It's Monday" << std::endl;
-    COUT(4) << "Debug: x is 1.23456" << std::endl;
-    @endcode
-*/
-
-#ifndef _Util_Debug_H__
-#define _Util_Debug_H__
-
-#include "UtilPrereqs.h"
-#include "OutputHandler.h"
-
-namespace orxonox
-{
-    // Just for convenience
-    using std::endl;
-
-    // Adjust this to discard certain output with level > hardDebugLevel at compile time already
-#ifdef ORXONOX_RELEASE
-    const int hardDebugLevel = OutputLevel::Verbose;
-#else
-    //! Maximum level for debug output that should be even processed at run time
-    const int hardDebugLevel = OutputLevel::Ultra;
-#endif
-
-    //! This function simply returns 0 and helps to suppress the "statement has no effect" compiler warning
-    inline int debugDummyFunction()
-    {
-        return 0;
-    }
-}
-
-/**
-@brief
-    Logs text output: You can use COUT(level) exactly like @c std::cout, but you have to specify an output level as argument.
-@param level
-    The level of the following output (passed with <tt><< "text"</tt>). Lower levels are more important. See @ref COUTlevels "the description above" for a list of possible output levels.
-
-    Example:
-    @code
-    COUT(3) << "Some info" << std::endl; // Output with level 3
-    @endcode
-@note
-    <tt>(a > b ? 0 : c << "text")</tt> is equivalent to <tt>(a > b ? 0 : (c << "text")</tt>
-    where <tt>(a > b ? 0 : )</tt> stands for COUT(x). This should explain how
-    this macro magic can possibly even work ;)
-@remarks
-    The <tt>? :</tt> operator requires both possible results to have the type of
-    the first. This is achieved by the int conversion operator dummy
-    in the @ref orxonox::OutputHandler.
-*/
-#define COUT(level)                                                    \
-    /*if*/ (level > orxonox::hardDebugLevel) ?                         \
-        orxonox::debugDummyFunction()                                  \
-    /*else*/ :                                                         \
-        /*if*/ (level > orxonox::OutputHandler::getSoftDebugLevel()) ? \
-            orxonox::debugDummyFunction()                              \
-        /*else*/ :                                                     \
-            orxonox::OutputHandler::getOutStream(level)
-
-/** Logs debug output: You can use DOUT exactly like @c std::cout.
-    Use this macro to produce temporary debug output that will be removed later on.
-    The console output shall have a special colour if available.
-*/
-#define DOUT orxonox::OutputHandler::getOutStream(-1) << "+++ "
-
-#endif /* _Util_Debug_H__ */
Index: code/trunk/src/libraries/util/Exception.cc
===================================================================
--- code/trunk/src/libraries/util/Exception.cc	(revision 8857)
+++ code/trunk/src/libraries/util/Exception.cc	(revision 8858)
@@ -37,5 +37,5 @@
 #include <cstddef>
 #include <CEGUIExceptions.h>
-#include "Debug.h"
+#include "Output.h"
 
 namespace orxonox
@@ -111,6 +111,6 @@
         catch (...)
         {
-            COUT(0) << "BIG WARNING: Unknown exception type encountered."
-                    << "Rethrowing" << endl;
+            orxout(user_error) << "BIG WARNING: Unknown exception type encountered."
+                               << " Rethrowing" << endl;
             throw;
         }
Index: code/trunk/src/libraries/util/Exception.h
===================================================================
--- code/trunk/src/libraries/util/Exception.h	(revision 8857)
+++ code/trunk/src/libraries/util/Exception.h	(revision 8858)
@@ -63,5 +63,5 @@
 #include <sstream>
 #include <string>
-#include "Debug.h"
+#include "Output.h"
 
 namespace orxonox
@@ -176,6 +176,6 @@
     inline const T& exceptionThrowerHelper(const T& exception)
     {
-        // let the catcher decide whether to display the message below level 4
-        COUT(4) << exception.getFullDescription() << std::endl;
+        // let the catcher decide whether to display the message also to the user
+        orxout(internal_error) << exception.getFullDescription() << endl;
         return exception;
     }
Index: code/trunk/src/libraries/util/ExprParser.h
===================================================================
--- code/trunk/src/libraries/util/ExprParser.h	(revision 8857)
+++ code/trunk/src/libraries/util/ExprParser.h	(revision 8858)
@@ -55,10 +55,10 @@
             if (!expr.getRemains().empty())
             {
-                COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << std::endl;
+                orxout(user_warning) << "Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << endl;
             }
             float result = expr.getResult();
         }
         else
-            COUT(1) << "Error: Cannot calculate expression: Parse error." << std::endl;
+            orxout(user_error) << "Cannot calculate expression: Parse error." << endl;
         @endcode
         getRemains() returns the expression after what could be parsed. For instance
Index: code/trunk/src/libraries/util/MultiType.h
===================================================================
--- code/trunk/src/libraries/util/MultiType.h	(revision 8857)
+++ code/trunk/src/libraries/util/MultiType.h	(revision 8858)
@@ -78,5 +78,5 @@
     void myfunction(int value)
     {
-        COUT(0) << "doubled value is " << (2 * value) << std::endl;
+        orxout() << "doubled value is " << (2 * value) << endl;
     }
 
Index: code/trunk/src/libraries/util/OrxAssert.h
===================================================================
--- code/trunk/src/libraries/util/OrxAssert.h	(revision 8857)
+++ code/trunk/src/libraries/util/OrxAssert.h	(revision 8858)
@@ -40,5 +40,5 @@
 
 #include <cassert>
-#include "Debug.h"
+#include "Output.h"
 
 #ifndef NDEBUG
@@ -46,5 +46,5 @@
 /** Run time assertion like assert(), but with an embedded message.
 @details
-    The message will be printed as error with COUT(1). <br>
+    The message will be printed as error with orxout(user_error). <br>
     You can use the same magic here as you can with \ref ThrowException
     @code
@@ -57,8 +57,8 @@
         if (!(condition)) \
         { \
-            COUT(1) << __FILE__ << "(" << __LINE__ << "): "; \
-            COUT(1) << "Assertion failed in " << __FUNCTIONNAME__ << std::endl; \
-            COUT(1) << "Expression: " << #condition << std::endl; \
-            COUT(1) << "Message   : " << errorMessage << std::endl; \
+            orxout(user_error) << __FILE__ << "(" << __LINE__ << "): "; \
+            orxout(user_error) << "Assertion failed in " << __FUNCTIONNAME__ << endl; \
+            orxout(user_error) << "Expression: " << #condition << endl; \
+            orxout(user_error) << "Message   : " << errorMessage << endl; \
             /* Don't use the condition again to avoid double evaluation */ \
             /* Instead, stringify the expression and negate it */ \
@@ -70,5 +70,5 @@
     mode (no abort() triggered then).
 @details
-    The message will be printed as error with COUT(1). <br>
+    The message will be printed as error with orxout(user_error). <br>
     You can use the same magic here as you can with \ref ThrowException
     @code
@@ -81,8 +81,8 @@
         if (!(condition)) \
         { \
-            COUT(1) << __FILE__ << "(" << __LINE__ << "): "; \
-            COUT(1) << "Verification failed in " << __FUNCTIONNAME__ << std::endl; \
-            COUT(1) << "Expression: " << #condition << std::endl; \
-            COUT(1) << "Message   : " << errorMessage << std::endl; \
+            orxout(user_error) << __FILE__ << "(" << __LINE__ << "): "; \
+            orxout(user_error) << "Verification failed in " << __FUNCTIONNAME__ << endl; \
+            orxout(user_error) << "Expression: " << #condition << endl; \
+            orxout(user_error) << "Message   : " << errorMessage << endl; \
             /* Don't use the condition again to avoid double evaluation */ \
             /* Instead, stringify the expression and negate it */ \
@@ -100,8 +100,8 @@
         if (!(condition)) \
         { \
-            COUT(1) << __FILE__ << "(" << __LINE__ << "): "; \
-            COUT(1) << "Verification failed in " << __FUNCTIONNAME__ << std::endl; \
-            COUT(1) << "Expression: " << #condition << std::endl; \
-            COUT(1) << "Message   : " << errorMessage << std::endl; \
+            orxout(user_error) << __FILE__ << "(" << __LINE__ << "): "; \
+            orxout(user_error) << "Verification failed in " << __FUNCTIONNAME__ << endl; \
+            orxout(user_error) << "Expression: " << #condition << endl; \
+            orxout(user_error) << "Message   : " << errorMessage << endl; \
             /* No assert() in release configuration */ \
         } \
Index: code/trunk/src/libraries/util/Output.h
===================================================================
--- code/trunk/src/libraries/util/Output.h	(revision 8858)
+++ code/trunk/src/libraries/util/Output.h	(revision 8858)
@@ -0,0 +1,116 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+/**
+    @defgroup Output Output system
+    @ingroup Util
+*/
+
+/**
+    @file
+    @ingroup Output
+    @brief Defines the helper function orxout() and includes all necessary headers to use the output system.
+
+    The output system is used to write output to the console, the logfile, and
+    other instances of orxonox::OutputListener. Each line of output is assigned
+    a level and a context. The level defines the type and importance of a
+    message, e.g. if it's a fatal error or just some internal information.
+    The context defines to which part of the program the output belongs.
+    Levels and contexts are defined in OutputDefinitions.h
+
+    Each orxonox::OutputListener can define a mask of desired levels and
+    contexts, to receive only a part of the output. Instances of
+    orxonox::SubcontextOutputListener are even able to filter sub-contexts.
+    A derivative of orxonox::BaseWriter is able to define these levels and
+    contexts through config values.
+
+    @attention
+    A message sent to the output system MUST end with "endl" or the message
+    won't be flushed.
+
+    @code
+    orxout() << "Debug output" << endl;
+    orxout(user_info) << "Orxonox version 1.2.3" << endl;
+    orxout(internal_status, context::input) << "Loading joystick" << endl;
+    @endcode
+*/
+
+#ifndef _Output_H__
+#define _Output_H__
+
+#include "UtilPrereqs.h"
+#include "output/OutputStream.h"
+
+namespace orxonox
+{
+    // Just for convenience
+    using std::endl;
+
+    /**
+        @brief This helper function returns a reference to a commonly used
+        instance of OutputStream.
+
+        It can be used like std::cout except that it is a function. You can
+        pass level and context of the following output as function arguments.
+    */
+    inline OutputStream& orxout(OutputLevel level = level::debug_output, const OutputContextContainer& context = context::undefined())
+    {
+        static OutputStream stream;
+        stream.setOutputAttributes(level, context);
+        return stream;
+    }
+
+    /**
+        @brief Shortcut for orxout() to allow passing contexts directly as
+        functions without using "()".
+
+        @code
+        orxout(user_info, context::example) << "Hello World" << endl; // calls this function
+        orxout(user_info, context::example()) << "Hello World" << endl; // calls the other orxout function
+        @endcode
+    */
+    inline OutputStream& orxout(OutputLevel level, OutputContextFunction context)
+    {
+        return orxout(level, context());
+    }
+
+    // COUT() is deprecated, please use orxout()
+    inline __DEPRECATED__(OutputStream& COUT(int level));
+
+    /**
+        @brief Writes output to the orxonox console. This function is deprecated, please use orxout()
+        @note The output level argument is ignored since it's not supported anymore. See orxout() for the new output levels.
+        @deprecated This function is deprecated. Use orxout() instead.
+    */
+    inline OutputStream& COUT(int)
+    {
+        return orxout();
+    }
+}
+
+#endif /* _Output_H__ */
Index: code/trunk/src/libraries/util/OutputHandler.cc
===================================================================
--- code/trunk/src/libraries/util/OutputHandler.cc	(revision 8857)
+++ 	(revision )
@@ -1,356 +1,0 @@
-/*
- *   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:
- *      Reto Grieder
- *
- */
-
-/**
-@file
-@brief
-    Definition of classes related to output (logging).
-*/
-
-#include "OutputHandler.h"
-
-#include <algorithm>
-#include <ctime>
-#include <cstdlib>
-#include <fstream>
-#include <iostream>
-#include <sstream>
-
-#include "Debug.h"
-
-namespace orxonox
-{
-    //! How the log file shall be named on the filesystem
-    const std::string logFileBaseName_g = "orxonox.log";
-
-    /////////////////////////
-    ///// LogFileWriter /////
-    /////////////////////////
-    /**
-    @brief
-        Writes the output to the log file.
-    @note
-        As long as the correct log path is not yet known (for pre main code), the
-        LogFileWriter will write to a temporary file in /temp (Unix) or %TEMP% (Windows).
-        As soon as you set the correct path setLogPath the content of the temporary file
-        is read and put into the new file as well.
-    */
-    class LogFileWriter : public OutputListener
-    {
-    public:
-        /**
-        @brief
-            Gets temporary log path and starts the log file
-        */
-        LogFileWriter()
-            : OutputListener("LogFile")
-        {
-            // Get path for a temporary file
-#ifdef ORXONOX_PLATFORM_WINDOWS
-            char* pTempDir = getenv("TEMP");
-            this->logFilename_ = std::string(pTempDir) + '/' + logFileBaseName_g;
-#else
-            this->logFilename_ = std::string("/tmp/") + logFileBaseName_g;
-#endif
-
-            // Get current time
-            time_t rawtime;
-            struct tm* timeinfo;
-            time(&rawtime);
-            timeinfo = localtime(&rawtime);
-
-            this->openFile();
-            if (this->logFile_.is_open())
-            {
-                this->logFile_ << "Started log on " << asctime(timeinfo) << std::endl;
-                this->logFile_.flush();
-            }
-        }
-
-        //! Closes the log file
-        ~LogFileWriter()
-        {
-            if (this->logFile_.is_open())
-            {
-                this->logFile_ << "Closed log" << std::endl;
-                this->logFile_.close();
-            }
-        }
-
-        //! Changes the log path
-        void setLogPath(const std::string& path)
-        {
-            if (this->logFile_.is_open())
-                this->logFile_.close();
-
-            // Open the new file
-            this->logFilename_ = path + logFileBaseName_g;
-            this->openFile();
-        }
-
-        //! Erases the log file
-        void clearFile()
-        {
-            if (this->logFile_.is_open())
-            {
-                this->logFile_.close();
-                this->openFile();
-            }
-        }
-
-    private:
-        void openFile()
-        {
-            this->logFile_.open(this->logFilename_.c_str(), std::fstream::out);
-
-            if (this->logFile_.is_open())
-                this->outputStream_ = &this->logFile_;
-            else
-            {
-                COUT(2) << "Warning: Failed to open log file. File logging disabled." << std::endl;
-                this->outputStream_ = NULL;
-            }
-        }
-
-        std::ofstream logFile_;     //!< File handle for the log file
-        std::string   logFilename_; //!< Filename of the log file
-    };
-
-
-    /////////////////////////
-    ///// ConsoleWriter /////
-    /////////////////////////
-    /**
-    @brief
-        Writes the output to std::cout.
-    @note
-        This listener will usually be disable once an actual shell with console is instantiated.
-    */
-    class ConsoleWriter : public OutputListener
-    {
-    public:
-        //! Only assigns the output stream with std::cout
-        ConsoleWriter()
-            : OutputListener("Console")
-        {
-            this->outputStream_ = &std::cout;
-        }
-    };
-
-
-    ///////////////////////////
-    ///// MemoryLogWriter /////
-    ///////////////////////////
-    /**
-    @brief
-        OutputListener that writes all the output piece by piece to an array
-        associated with the corresponding output level.
-        Used as buffer until all output devices have been initialised.
-    @note
-        At some point, OutputHandler::disableMemoryLog() has to be called in
-        order to avoid large memory footprints of this class.
-    */
-    class MemoryLogWriter : public OutputListener
-    {
-    public:
-        friend class OutputHandler;
-
-        MemoryLogWriter()
-            : OutputListener("memoryLog")
-        {
-            this->outputStream_ = &this->buffer_;
-        }
-
-        //! Push the just written output to the internal array
-        void outputChanged(int level)
-        {
-            if (!this->buffer_.str().empty())
-            {
-                // Read ostringstream and store it
-                this->output_.push_back(std::make_pair(level, this->buffer_.str()));
-                // Clear content and flags
-                this->buffer_.str(std::string());
-            }
-            this->buffer_.clear();
-        }
-
-    private:
-        std::ostringstream          buffer_; //!< Stream object used to process the output
-        OutputHandler::OutputVector output_; //!< Vector containing ALL output
-    };
-
-
-    /////////////////////////
-    ///// OutputHandler /////
-    /////////////////////////
-    int OutputHandler::softDebugLevel_s = hardDebugLevel;
-
-    //! Creates the LogFileWriter and the MemoryLogWriter
-    OutputHandler::OutputHandler()
-        : outputLevel_(OutputLevel::Verbose)
-    {
-        // Note: These levels only concern startup before orxonox.ini is read.
-#ifdef ORXONOX_RELEASE
-        const OutputLevel::Value initialLevelConsole = OutputLevel::Error;
-#else
-        const OutputLevel::Value initialLevelConsole = OutputLevel::Info;
-#endif
-        // Use high log level because we rewrite the log file anyway with the
-        // correct level. But if Orxonox were to crash before that, we might be
-        // grateful to have a high debug level, esp. for releases.
-        const OutputLevel::Value intialLevelLogFile = OutputLevel::Debug;
-
-        this->logFile_ = new LogFileWriter();
-        // Use default level until we get the configValue from the Core
-        this->logFile_->softDebugLevel_ = intialLevelLogFile;
-        this->registerOutputListener(this->logFile_);
-
-        this->consoleWriter_ = new ConsoleWriter();
-        this->consoleWriter_->softDebugLevel_ = initialLevelConsole;
-        this->registerOutputListener(this->consoleWriter_);
-
-        this->memoryBuffer_ = new MemoryLogWriter();
-        // Write everything, e.g. use hardDebugLevel
-        this->memoryBuffer_->softDebugLevel_ = hardDebugLevel;
-        this->registerOutputListener(this->memoryBuffer_);
-    }
-
-    //! Destroys the LogFileWriter and the MemoryLogWriter
-    OutputHandler::~OutputHandler()
-    {
-        delete this->logFile_;
-        delete this->consoleWriter_;
-        delete this->memoryBuffer_; // Might already be NULL
-    }
-
-    OutputHandler& OutputHandler::getInstance()
-    {
-        static OutputHandler orxout;
-        return orxout;
-    }
-
-    void OutputHandler::registerOutputListener(OutputListener* listener)
-    {
-        for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
-        {
-            if ((*it)->name_ == listener->name_)
-            {
-                COUT(2) << "OutputHandler, Warning: Trying to register two listeners with the same name!" << std::endl;
-                return;
-            }
-        }
-        this->listeners_.push_back(listener);
-        this->updateGlobalDebugLevel();
-    }
-
-    void OutputHandler::unregisterOutputListener(OutputListener* listener)
-    {
-        for (std::vector<OutputListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
-        {
-            if ((*it)->name_ == listener->name_)
-            {
-                this->listeners_.erase(it);
-                break;
-            }
-        }
-        this->updateGlobalDebugLevel();
-    }
-
-    void OutputHandler::setLogPath(const std::string& path)
-    {
-        this->logFile_->setLogPath(path);
-        this->rewriteLogFile();
-    }
-
-    void OutputHandler::rewriteLogFile()
-    {
-        logFile_->clearFile();
-
-        if (logFile_->outputStream_ == NULL)
-            return;
-
-        for (OutputVector::const_iterator it = this->getOutput().begin(); it != this->getOutput().end(); ++it)
-        {
-            if (it->first <= logFile_->softDebugLevel_)
-                (*logFile_->outputStream_) << it->second;
-        }
-        logFile_->outputStream_->flush();
-    }
-
-    void OutputHandler::disableCout()
-    {
-        this->unregisterOutputListener(this->consoleWriter_);
-    }
-
-    void OutputHandler::enableCout()
-    {
-        this->registerOutputListener(this->consoleWriter_);
-    }
-
-    void OutputHandler::disableMemoryLog()
-    {
-        this->unregisterOutputListener(this->memoryBuffer_);
-        // Only clear the buffer so we can still reference the vector
-        this->memoryBuffer_->output_.clear();
-    }
-
-    const OutputHandler::OutputVector& OutputHandler::getOutput() const
-    {
-        return this->memoryBuffer_->output_;
-    }
-
-    int OutputHandler::getSoftDebugLevel(const std::string& name) const
-    {
-        for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
-        {
-            if ((*it)->name_ == name)
-                return (*it)->softDebugLevel_;
-        }
-        return -1;
-    }
-
-    void OutputHandler::setSoftDebugLevel(const std::string& name, int level)
-    {
-        for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
-        {
-            if ((*it)->name_ == name)
-                (*it)->softDebugLevel_ = level;
-        }
-        this->updateGlobalDebugLevel();
-    }
-
-    void OutputHandler::updateGlobalDebugLevel()
-    {
-        int globalSoftDebugLevel = -1;
-        std::vector<OutputListener*>::const_iterator it = this->listeners_.begin();
-        for (; it != this->listeners_.end(); ++it)
-            globalSoftDebugLevel = std::max(globalSoftDebugLevel, (*it)->softDebugLevel_);
-
-        OutputHandler::softDebugLevel_s = globalSoftDebugLevel;
-    }
-}
Index: code/trunk/src/libraries/util/OutputHandler.h
===================================================================
--- code/trunk/src/libraries/util/OutputHandler.h	(revision 8857)
+++ 	(revision )
@@ -1,285 +1,0 @@
-/*
- *   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:
- *      Reto Grieder
- *
- */
-
-/**
-@file
-@ingroup Util Output
-@brief
-    Declaration of classes related to output (logging), most notably OutputHandler and OutputListener.
-*/
-
-#ifndef _OutputHandler_H__
-#define _OutputHandler_H__
-
-#include "UtilPrereqs.h"
-
-#include <ostream>
-#include <string>
-#include <vector>
-#include <utility>
-
-namespace orxonox
-{
-    /**
-    @brief
-        Denotes different levels of text output (log output)
-
-         - 0, None   : Very important output
-         - 1, Error  : Errors
-         - 2, Warning: Warnings
-         - 3, Info   : Information
-         - 4, Debug  : Debug information
-         - 5, Verbose: More debug information
-         - 6, Ultra  : Crazy debug information
-    */
-    namespace OutputLevel
-    {
-        enum Value
-        {
-            TDebug  = -1,
-            None    = 0,
-            Error   = 1,
-            Warning = 2,
-            Info    = 3,
-            Debug   = 4,
-            Verbose = 5,
-            Ultra   = 6,
-        };
-    }
-
-    // Forward declarations for classes in the source file
-    class LogFileWriter;
-    class ConsoleWriter;
-    class MemoryLogWriter;
-
-    /**
-    @brief
-        The OutputHandler acts like @c std::cout, but output isn't only shown in the console.
-
-        Output passed to the OutputHandler is distributed to all registered listeners,
-        for example the console, the logfile, or the ingame shell.
-
-        You can register your own listener for output by inheriting from OutputListener.
-        And if you need the output previously processed, iterate over it with
-        OutputHandler::getOutputVectorBegin and OutputHandler::getOutputVectorEnd.
-
-        The way to output text is to first set the desired output level with
-        @ref getOutStream "OutputHandler::getOutStream(level)" and then use
-        the "<<" operator like with @c std::cout. Alternatively you can use the COUT() macro.
-    */
-    class _UtilExport OutputHandler
-    {
-        public:
-            //! Returns a reference to the only existing instance of the OutputHandler class.
-            static OutputHandler& getInstance();
-
-            //! Sets the output level and returns a stream to be used with "<<"
-            static inline OutputHandler& getOutStream(int level)
-                { return OutputHandler::getInstance().setOutputLevel(level); }
-
-            typedef std::vector<std::pair<int, std::string> > OutputVector;
-            //! Returns all output written so far (empty if disableMemoryLog() was called)
-            const OutputVector& getOutput() const;
-
-            //! Writes to all output devices
-            static inline void log(const std::string& text)
-                { OutputHandler::getOutStream(0).output(text) << std::endl; }
-
-            //! Writes an error message to the output
-            static inline void error(const std::string& text)
-                { OutputHandler::getOutStream(1).output(text) << std::endl; }
-
-            //! Writes a warning message to the output
-            static inline void warning(const std::string& text)
-                { OutputHandler::getOutStream(2).output(text) << std::endl; }
-
-            //! Writes an informational message to the output
-            static inline void info(const std::string& text)
-                { OutputHandler::getOutStream(3).output(text) << std::endl; }
-
-            //! Writes a debug message to the output
-            static inline void debug(const std::string& text)
-                { OutputHandler::getOutStream(4).output(text) << std::endl; }
-
-            //! Registers an object that receives output via a provided std::ostream
-            void registerOutputListener(OutputListener* listener);
-            //! Unregisters an object that receives output via a provided std::ostream
-            void unregisterOutputListener(OutputListener* listener);
-
-            //! Set the log path once the program has been properly initialised
-            void setLogPath(const std::string& path);
-            /** Rewrites the log file (completely respects the current debug level).
-                Once disableMemoryLog() has been called, this function will do nothing.
-            */
-            void rewriteLogFile();
-
-            //! Disables the std::cout stream for output
-            void disableCout();
-            //! Enables the std::cout stream for output (startup behaviour)
-            void enableCout();
-            //! Stop writing to the memory buffer (call this as soon as possible to minimise memory usage)
-            void disableMemoryLog();
-
-            //! Sets the level of the incoming output and returns the OutputHandler
-            inline OutputHandler& setOutputLevel(int level)
-                { this->outputLevel_ = level; return *this; }
-
-            //! Returns the level of the incoming output
-            inline int getOutputLevel() const
-                { return this->outputLevel_; }
-
-            //! Returns the maximum debug level over all registered listeners (devices)
-            static int getSoftDebugLevel() { return softDebugLevel_s; }
-            //! Returns the soft debug level for a device by its name   @return The level or -1 if the listener was not found
-            int  getSoftDebugLevel(const std::string& name) const;
-            //! Sets the soft debug level for a listener by its name   @remarks Only works for registered listeners!
-            void setSoftDebugLevel(const std::string& name, int level);
-
-            /**
-            @brief
-                General template that copes with all output.
-                Required because operator << might be ambiguous.
-                @a output will be streamed into every listener with an appropriate debug level
-            @return
-                Returns a reference to the OutputHandler so you can use it again directly
-            */
-            template <class T>
-            OutputHandler& output(const T& output);
-
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(unsigned char val)      { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(short val)              { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(unsigned short val)     { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(int val)                { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(unsigned int val)       { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(long val)               { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(unsigned long val)      { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(long long val)          { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(unsigned long long val) { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(float val)              { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(double val)             { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(long double val)        { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(const void* val)        { return this->output(val); }
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(bool val)               { return this->output(val); }
-
-            //! Overloaded << operator, redirects the output to the listeners
-            inline OutputHandler& operator<<(std::streambuf* sb)     { return this->output(sb); }
-
-            //! Overloaded << operator, redirect the output of classes with self defined 'operator <<' to the listeners
-            template <class T>
-            inline OutputHandler& operator<<(const T& val)           { return this->output(val); }
-
-            //! Overloaded << operator for std manipulators like std::endl, redirects the output to the listeners
-            inline OutputHandler& operator<<(std::ostream&  (*manip)(std::ostream&))  { return this->output(manip); }
-            //! Overloaded << operator for std manipulators like std::endl, redirects the output to the listeners
-            inline OutputHandler& operator<<(std::ios&      (*manip)(std::ios&))      { return this->output(manip); }
-            //! Overloaded << operator for std manipulators like std::endl, redirects the output to the listeners
-            inline OutputHandler& operator<<(std::ios_base& (*manip)(std::ios_base&)) { return this->output(manip); }
-
-            //! Dummy operator required by Debug.h for the ternary operator
-            inline operator int() const { return 0; }
-
-        private:
-            OutputHandler();
-            ~OutputHandler();
-            OutputHandler(const OutputHandler& rhs);      //!< Copy-constructor: Unused and undefined
-
-            /// Evaluates the maximum global log level
-            void updateGlobalDebugLevel();
-
-            std::vector<OutputListener*> listeners_;        //!< Array with all registered output listeners
-            int                          outputLevel_;      //!< The level of the incoming output
-            LogFileWriter*               logFile_;          //!< Writes output to the log file
-            ConsoleWriter*               consoleWriter_;    //!< Writes to std::cout (can be disabled)
-            MemoryLogWriter*             memoryBuffer_;     //!< Writes to memory as a buffer (can/must be stopped at some time)
-            static int                   softDebugLevel_s;  //!< Maximum of all soft debug levels. @note This is only static for faster access
-    };
-
-    /**
-    @brief
-        Interface for listening to output.
-    @remarks
-        Remember to register the listener (not done automatically!)
-    */
-    class OutputListener
-    {
-        friend class OutputHandler;
-
-    public:
-        OutputListener(const std::string& name)
-            : outputStream_(NULL)
-            , name_(name)
-            , softDebugLevel_(OutputLevel::Info)
-        {}
-        virtual ~OutputListener() {}
-
-        //! Gets called whenever output is put into the stream
-        virtual void outputChanged(int level) {}
-        //! Returns the name of this output listener
-        const std::string& getOutputListenerName() const { return this->name_; }
-
-    protected:
-        std::ostream*     outputStream_;   //!< Pointer to the associated output stream, can be NULL
-
-    private:
-        const std::string name_;           //!< Name of the listener, constant and unique!
-        int               softDebugLevel_; //!< Current soft debug level that defines what kind of output is written to the stream
-    };
-
-    template<class T>
-    inline OutputHandler& OutputHandler::output(const T& output)
-    {
-        for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
-        {
-            if (this->outputLevel_ <= (*it)->softDebugLevel_ && (*it)->outputStream_ != NULL)
-            {
-                std::ostream& stream = *((*it)->outputStream_);
-                stream << output;
-                stream.flush();
-                (*it)->outputChanged(this->outputLevel_);
-            }
-        }
-
-        return *this;
-    }
-}
-
-#endif /* _OutputHandler_H__ */
Index: code/trunk/src/libraries/util/Scope.h
===================================================================
--- code/trunk/src/libraries/util/Scope.h	(revision 8857)
+++ code/trunk/src/libraries/util/Scope.h	(revision 8858)
@@ -60,5 +60,5 @@
 #include <loki/ScopeGuard.h>
 
-#include "Debug.h"
+#include "Output.h"
 
 namespace orxonox
@@ -128,4 +128,6 @@
             Scope()
             {
+                orxout(internal_status) << "creating scope... (" << scope << ")" << endl;
+
                 try
                 {
@@ -148,4 +150,6 @@
                     throw;
                 }
+
+                orxout(internal_status) << "created scope (" << scope << ")" << endl;
             }
 
@@ -153,4 +157,6 @@
             ~Scope()
             {
+                orxout(internal_status) << "destroying scope... (" << scope << ")" << endl;
+
                 ScopeManager::instanceCounts_s[scope]--;
 
@@ -162,4 +168,6 @@
                 if (ScopeManager::instanceCounts_s[scope] == 0)
                     this->deactivateListeners();
+
+                orxout(internal_status) << "destroyed scope (" << scope << ")" << endl;
             }
 
@@ -174,5 +182,5 @@
                             { (*it)->deactivated(); }
                         catch (...)
-                            { COUT(0) << "ScopeListener::deactivated() failed! This MUST NOT happen, fix it!" << std::endl; }
+                            { orxout(internal_warning) << "ScopeListener::deactivated() failed! This MUST NOT happen, fix it!" << endl; }
                         (*(it++))->bActivated_ = false;
                     }
Index: code/trunk/src/libraries/util/ScopedSingletonManager.h
===================================================================
--- code/trunk/src/libraries/util/ScopedSingletonManager.h	(revision 8857)
+++ code/trunk/src/libraries/util/ScopedSingletonManager.h	(revision 8858)
@@ -231,7 +231,7 @@
                 { singletonPtr_ = new T(); }
             catch (const InitialisationAbortedException& ex)
-                { COUT(3) << ex.getDescription() << std::endl; }
+                { orxout(internal_error) << ex.getDescription() << endl; }
             catch (...)
-                { COUT(1) << "Singleton creation failed: " << Exception::handleMessage() << std::endl; }
+                { orxout(internal_error) << "Singleton creation failed: " << Exception::handleMessage() << endl; }
         }
 
Index: code/trunk/src/libraries/util/SignalHandler.cc
===================================================================
--- code/trunk/src/libraries/util/SignalHandler.cc	(revision 8857)
+++ code/trunk/src/libraries/util/SignalHandler.cc	(revision 8858)
@@ -39,5 +39,5 @@
 #include <cstdio>
 
-#include "Debug.h"
+#include "Output.h"
 
 namespace orxonox
@@ -127,5 +127,5 @@
       if( SignalHandler::singletonPtr_s == 0 )
       {
-        COUT(0) << "Received signal " << sigName.c_str() << std::endl << "Can't write backtrace because SignalHandler is already destroyed" << std::endl;
+        orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
         exit(EXIT_FAILURE);
       }
@@ -137,5 +137,5 @@
 
 
-      COUT(0) << "Received signal " << sigName.c_str() << std::endl << "Try to write backtrace to file orxonox_crash.log" << std::endl;
+      orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl;
 
       
@@ -206,5 +206,5 @@
 #ifdef PR_SET_PTRACER
         if( prctl(PR_SET_PTRACER, gdbPid, 0, 0, 0) == -1 )
-          COUT(0) << "could not set proper permissions for GDB to attach to process..." << endl;
+          orxout(user_error) << "could not set proper permissions for GDB to attach to process..." << endl;
 #endif
         
@@ -213,9 +213,9 @@
 
         if( read( sigPipe[0], &someData, sizeof(someData) ) != sizeof(someData) )
-          COUT(0) << "something went wrong :(" << std::endl;
+          orxout(user_error) << "something went wrong :(" << endl;
 
         if ( someData != 0x12345678 )
         {
-          COUT(0) << "something went wrong :(" << std::endl;
+          orxout(user_error) << "something went wrong :(" << endl;
         }
 
@@ -328,5 +328,5 @@
       if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
       {
-        COUT(0) << "could not write " << bt.length() << " byte to " << getInstance().filename << std::endl;
+        orxout(user_error) << "could not write " << bt.length() << " byte to " << getInstance().filename << endl;
         exit(EXIT_FAILURE);
       }
@@ -364,6 +364,7 @@
 _UtilExport void __cdecl abort()
 {
-    COUT(1) << "This application has requested the Runtime to terminate it in an unusual way." << std::endl;
-    COUT(1) << "Please contact the application's support team for more information." << std::endl;
+    using namespace orxonox;
+    orxout(user_error) << "This application has requested the Runtime to terminate it in an unusual way." << endl;
+    orxout(user_error) << "Please contact the application's support team for more information." << endl;
     DebugBreak();
     exit(0x3);
@@ -373,6 +374,7 @@
 _UtilExport void __cdecl _assert(const char* expression, const char* file, int line)
 {
-    COUT(1) << "Assertion failed: " << expression << ", file " << file << ", line " << line << std::endl;
-    COUT(1) << std::endl;
+    using namespace orxonox;
+    orxout(user_error) << "Assertion failed: " << expression << ", file " << file << ", line " << line << endl;
+    orxout(user_error) << endl;
     abort();
 }
@@ -423,14 +425,14 @@
             bExecuting = true;
 
-            COUT(1) << std::endl;
+            orxout(user_error) << endl;
 
             // if the signalhandler has already been destroyed then don't do anything
             if (SignalHandler::singletonPtr_s == 0)
             {
-                COUT(1) << "Caught an unhandled exception" << std::endl << "Can't write backtrace because SignalHandler is already destroyed" << std::endl;
+                orxout(user_error) << "Caught an unhandled exception" << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
                 exit(EXIT_FAILURE);
             }
 
-            COUT(1) << "Caught an unhandled exception" << std::endl << "Try to write backtrace to orxonox_crash.log..." << std::endl;
+            orxout(user_error) << "Caught an unhandled exception" << endl << "Try to write backtrace to orxonox_crash.log..." << endl;
 
             // write the crash log
@@ -439,27 +441,27 @@
             time_t now = time(NULL);
 
-            crashlog << "=======================================================" << std::endl;
+            crashlog << "=======================================================" << endl;
             crashlog << "= Time: " << std::string(ctime(&now));
-            crashlog << "=======================================================" << std::endl;
-            crashlog << std::endl;
+            crashlog << "=======================================================" << endl;
+            crashlog << endl;
 
             const std::string& error = SignalHandler::getExceptionType(pExceptionInfo);
 
-            crashlog << error << std::endl;
-            crashlog << std::endl;
+            crashlog << error << endl;
+            crashlog << endl;
 
             const std::string& callstack = SignalHandler::getStackTrace(pExceptionInfo);
 
-            crashlog << "Call stack:" << std::endl;
-            crashlog << callstack << std::endl;
+            crashlog << "Call stack:" << endl;
+            crashlog << callstack << endl;
 
             crashlog.close();
 
             // print the same information also to the console
-            COUT(1) << std::endl;
-            COUT(1) << error << std::endl;
-            COUT(1) << std::endl;
-            COUT(1) << "Call stack:" << std::endl;
-            COUT(1) << callstack << std::endl;
+            orxout(user_error) << endl;
+            orxout(user_error) << error << endl;
+            orxout(user_error) << endl;
+            orxout(user_error) << "Call stack:" << endl;
+            orxout(user_error) << callstack << endl;
 
             bExecuting = false;
@@ -467,5 +469,5 @@
         else
         {
-            COUT(1) << "An error occurred while writing the backtrace" << std::endl;
+            orxout(user_error) << "An error occurred while writing the backtrace" << endl;
         }
 
Index: code/trunk/src/libraries/util/Singleton.h
===================================================================
--- code/trunk/src/libraries/util/Singleton.h	(revision 8857)
+++ code/trunk/src/libraries/util/Singleton.h	(revision 8858)
@@ -100,5 +100,5 @@
     void TestSingleton::testFunction()                      // implement testFunction
     {
-        COUT(0) << "My value is " << this->testValue_ << std::endl;
+        orxout() << "My value is " << this->testValue_ << endl;
     }
 
Index: code/trunk/src/libraries/util/Sleep.cc
===================================================================
--- code/trunk/src/libraries/util/Sleep.cc	(revision 8857)
+++ code/trunk/src/libraries/util/Sleep.cc	(revision 8858)
@@ -34,5 +34,5 @@
 
 #include "Sleep.h"
-#include "Debug.h"
+#include "Output.h"
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -49,5 +49,5 @@
     {
         //if (microseconds < 1000)
-        //    COUT(2) << "Warning: Windows cannot sleep less than 1ms, ignoring" << std::endl;
+        //    orxout(internal_warning) << "Windows cannot sleep less than 1ms, ignoring" << endl;
         Sleep(microseconds / 1000);
     }
Index: code/trunk/src/libraries/util/StringUtils.cc
===================================================================
--- code/trunk/src/libraries/util/StringUtils.cc	(revision 8857)
+++ code/trunk/src/libraries/util/StringUtils.cc	(revision 8858)
@@ -79,4 +79,14 @@
         for (; pos2 > 0         && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--);
         return str.substr(pos1, pos2 - pos1 + 1);
+    }
+
+    /// Splits a given string by a delimiter and stores it in an output vector
+    void vectorize(const std::string& str, char delimiter, std::vector<std::string>* output)
+    {
+        for (size_t start = 0, end = 0; end != std::string::npos; start = end + 1)
+        {
+            end = str.find_first_of(delimiter, start);
+            output->push_back(str.substr(start, end - start));
+        }
     }
 
@@ -517,5 +527,5 @@
         return matrix[(rows-1)*cols + cols-1];
     }
-    
+
     /**
     @brief
Index: code/trunk/src/libraries/util/StringUtils.h
===================================================================
--- code/trunk/src/libraries/util/StringUtils.h	(revision 8857)
+++ code/trunk/src/libraries/util/StringUtils.h	(revision 8858)
@@ -43,4 +43,5 @@
 #include "UtilPrereqs.h"
 #include <string>
+#include <vector>
 
 namespace orxonox
@@ -54,4 +55,6 @@
 
     _UtilExport std::string  removeTrailingWhitespaces(const std::string& str);
+
+    _UtilExport void         vectorize(const std::string& str, char delimiter, std::vector<std::string>* output);
 
     _UtilExport size_t       getNextQuote(const std::string& str, size_t start);
@@ -88,5 +91,5 @@
 
     _UtilExport unsigned int getLevenshteinDistance(const std::string& str1, const std::string& str2);
-    
+
     _UtilExport std::string  getTimestamp(void);
 }
Index: code/trunk/src/libraries/util/SubString.cc
===================================================================
--- code/trunk/src/libraries/util/SubString.cc	(revision 8857)
+++ code/trunk/src/libraries/util/SubString.cc	(revision 8858)
@@ -45,5 +45,5 @@
 #include "SubString.h"
 #include <cstdio>
-#include "Debug.h"
+#include "Output.h"
 
 namespace orxonox
@@ -513,8 +513,8 @@
     void SubString::debug() const
     {
-        COUT(0) << "Substring-information::count=" << this->tokens_.size() << " ::";
+        orxout(debug_output) << "Substring-information::count=" << this->tokens_.size() << " ::";
         for (unsigned int i = 0; i < this->tokens_.size(); ++i)
-            COUT(0) << "s" << i << "='" << this->tokens_[i].c_str() << "'::";
-        COUT(0) << std::endl;
+            orxout(debug_output) << "s" << i << "='" << this->tokens_[i].c_str() << "'::";
+        orxout(debug_output) << endl;
     }
 }
Index: code/trunk/src/libraries/util/SubString.h
===================================================================
--- code/trunk/src/libraries/util/SubString.h	(revision 8857)
+++ code/trunk/src/libraries/util/SubString.h	(revision 8858)
@@ -59,5 +59,5 @@
 
     for (unsigned int i = 0; i < tokens.size(); ++i)
-        COUT(0) << i << ": " << tokens[i] << std::endl;
+        orxout() << i << ": " << tokens[i] << endl;
     @endcode
 
Index: code/trunk/src/libraries/util/UtilPrereqs.h
===================================================================
--- code/trunk/src/libraries/util/UtilPrereqs.h	(revision 8857)
+++ code/trunk/src/libraries/util/UtilPrereqs.h	(revision 8858)
@@ -88,6 +88,7 @@
     class ExprParser;
     class MultiType;
-    class OutputHandler;
     class OutputListener;
+    class OutputManager;
+    class OutputStream;
     template <ScopeID::Value>
     class Scope;
Index: code/trunk/src/libraries/util/output/BaseWriter.cc
===================================================================
--- code/trunk/src/libraries/util/output/BaseWriter.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/BaseWriter.cc	(revision 8858)
@@ -0,0 +1,147 @@
+/*
+ *   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
+    @brief Implementation of the BaseWriter class.
+*/
+
+#include "BaseWriter.h"
+
+#include "OutputManager.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor: Initializes the config-values.
+    */
+    BaseWriter::BaseWriter(const std::string& name, bool bRegister) : SubcontextOutputListener(bRegister)
+    {
+        this->name_ = name;
+
+        this->configurableMaxLevel_ = level::none;
+        this->configurableAdditionalContextsMaxLevel_ = level::verbose;
+        this->configurableAdditionalContexts_.push_back("example");
+
+        this->changedConfigurableLevel();
+        this->changedConfigurableAdditionalContextsLevel();
+        this->changedConfigurableAdditionalContexts();
+    }
+
+    /**
+        @brief Destructor.
+    */
+    BaseWriter::~BaseWriter()
+    {
+    }
+
+    /**
+        @brief This function is inherited from OutputListener, each message is split into lines and sent to printLine().
+    */
+    void BaseWriter::output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
+    {
+        const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context);
+        std::string blanks(prefix.length(), ' ');
+
+        for (size_t i = 0; i < lines.size(); ++i)
+            this->printLine((i == 0 ? prefix : blanks) + lines[i], level);
+    }
+
+    /**
+        @brief Overwritten implementation of the function inherited from OutputListener, sets also the corresponding config-value.
+    */
+    void BaseWriter::setLevelMax(OutputLevel max)
+    {
+        this->configurableMaxLevel_ = max;
+        this->changedConfigurableLevel();
+    }
+
+    /**
+        @brief Overwritten implementation of the function inherited from OutputListener, sets also the corresponding config-value.
+    */
+    void BaseWriter::setAdditionalContextsLevelMax(OutputLevel max)
+    {
+        this->configurableAdditionalContextsMaxLevel_ = max;
+        this->changedConfigurableAdditionalContextsLevel();
+    }
+
+    /**
+        @brief Called if the config value has changed, updates the corresponding mask in OutputListener.
+    */
+    void BaseWriter::changedConfigurableLevel()
+    {
+        OutputListener::setLevelMax(static_cast<OutputLevel>(this->configurableMaxLevel_));
+    }
+
+    /**
+        @brief Called if the config value has changed, updates the corresponding mask in OutputListener.
+    */
+    void BaseWriter::changedConfigurableAdditionalContextsLevel()
+    {
+        OutputListener::setAdditionalContextsLevelMax(static_cast<OutputLevel>(this->configurableAdditionalContextsMaxLevel_));
+    }
+
+    /**
+        @brief Called if the config-vector of accepted contexts has changed, updates the masks in SubcontextOutputListener.
+    */
+    void BaseWriter::changedConfigurableAdditionalContexts()
+    {
+        OutputContextMask main_contexts = context::none;
+        std::set<const OutputContextContainer*> sub_contexts;
+
+        // iterate over all strings in the config-vector
+        for (size_t i = 0; i < this->configurableAdditionalContexts_.size(); ++i)
+        {
+            const std::string& full_name = this->configurableAdditionalContexts_[i];
+
+            // split the name into main-name and sub-name (if given; otherwise sub-name remains empty). both names are separated by ::
+            std::string name = full_name;
+            std::string subname;
+
+            size_t pos = full_name.find("::");
+            if (pos != std::string::npos)
+            {
+                name = full_name.substr(0, pos);
+                subname = full_name.substr(pos + 2);
+            }
+
+            // get the context defined by this name
+            const OutputContextContainer& context = OutputManager::getInstance().registerContext(name, subname);
+
+            // if the context is a sub-context, insert it to the set of sub-contexts. Otherwise add it's mask to the mask of main-contexts.
+            if (context.sub_id == context::no_subcontext)
+                main_contexts |= context.mask;
+            else
+                sub_contexts.insert(&context);
+        }
+
+        // pass main-contexts and sub-contexts to SubcontextOutputListener
+        this->setAdditionalContextsMask(main_contexts);
+        this->setAdditionalSubcontexts(sub_contexts);
+    }
+}
Index: code/trunk/src/libraries/util/output/BaseWriter.h
===================================================================
--- code/trunk/src/libraries/util/output/BaseWriter.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/BaseWriter.h	(revision 8858)
@@ -0,0 +1,120 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the BaseWriter class, the base of all output writers.
+*/
+
+#ifndef _BaseWriter_H__
+#define _BaseWriter_H__
+
+#include "util/UtilPrereqs.h"
+#include "SubcontextOutputListener.h"
+
+namespace orxonox
+{
+    /**
+        @brief BaseWriter is an output listener and makes the accepted output levels and contexts configurable.
+
+        All output writers like ConsoleWriter and LogWriter are inherited from
+        this class. BaseWriter itself inherits from SubcontextOutputListener.
+        It adds helper functions to configure the accepted levels and contexts.
+
+        The levels are not fully configurable, only the "max" form is allowed
+        (which means that it's only possible to define a maximum level, not
+        the full mask).
+
+        Contexts are defined by a vector of strings, each context is defined
+        by it's name. Sub-contexts have the form \a "main-name::sub-name", i.e.
+        their name is concatenated with :: in between.
+
+        Each instance of BaseWriter needs a name to generate distinguishable
+        config values.
+
+        Received output messages are split into lines and sent line by line to
+        the virtual printLine() function. Each line has a prepended prefix
+        which describes the level and context of the output.
+    */
+    class _UtilExport BaseWriter : public SubcontextOutputListener
+    {
+        public:
+            BaseWriter(const std::string& name, bool bRegister = true);
+            virtual ~BaseWriter();
+
+            void setLevelMax(OutputLevel max);
+            void setAdditionalContextsLevelMax(OutputLevel max);
+
+            /// @brief Returns the name of this instance.
+            const std::string& getName() const
+                { return this->name_; }
+
+            /// Config value, used to define the maximum output level (independent of contexts)
+            int configurableMaxLevel_;
+            /// @brief Returns the name of the config value which defines the maximum output level (independent of contexts).
+            inline std::string getConfigurableMaxLevelName() const
+                { return this->name_ + "Level"; }
+
+            /// Config value, used to define the maximum output level of additional context
+            int configurableAdditionalContextsMaxLevel_;
+            /// @brief Returns the name of the config value which defines the maximum output level of additional context.
+            inline std::string getConfigurableAdditionalContextsMaxLevelName() const
+                { return this->name_ + "AdditionalContextsLevel"; }
+
+            /// Config vector, used to define the additional contexts (and sub-contexts)
+            std::vector<std::string> configurableAdditionalContexts_;
+            /// @brief Returns the name of the config vector which defines the additional contexts (and sub-contexts)
+            inline std::string getConfigurableAdditionalContextsName() const
+                { return this->name_ + "AdditionalContexts"; }
+
+            void changedConfigurableLevel();
+            void changedConfigurableAdditionalContextsLevel();
+            void changedConfigurableAdditionalContexts();
+
+            /// Returns the (static) name of the section wherein the config-values are defined.
+            static inline std::string getConfigurableSectionName()
+                { return "Output"; }
+
+        protected:
+            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines);
+
+        private:
+            virtual void printLine(const std::string& line, OutputLevel level) = 0; ///< Pure virtual function, gets called for each line of output together with a prefix which describes level and context of the output.
+
+            void setLevelRange(OutputLevel min, OutputLevel max);                   ///< Inherited function, overwritten as private because it is not supported by the config-value
+            void setLevelMask(OutputLevel mask);                                    ///< Inherited function, overwritten as private because it is not supported by the config-value
+
+            void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max); ///< Inherited function, overwritten as private because it is not supported by the config-value
+            void setAdditionalContextsLevelMask(OutputLevel mask);                  ///< Inherited function, overwritten as private because it is not supported by the config-value
+
+            std::string name_; ///< The name of this instance, used to generate unique config-values
+    };
+}
+
+#endif /* _BaseWriter_H__ */
Index: code/trunk/src/libraries/util/output/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/util/output/CMakeLists.txt	(revision 8858)
+++ code/trunk/src/libraries/util/output/CMakeLists.txt	(revision 8858)
@@ -0,0 +1,12 @@
+ADD_SOURCE_FILES(UTIL_SRC_FILES
+BUILD_UNIT OutputBuildUnit.cc
+  OutputStream.cc
+  OutputManager.cc
+  OutputListener.cc
+  SubcontextOutputListener.cc
+  BaseWriter.cc
+  ConsoleWriter.cc
+  LogWriter.cc
+  MemoryWriter.cc
+END_BUILD_UNIT
+)
Index: code/trunk/src/libraries/util/output/ConsoleWriter.cc
===================================================================
--- code/trunk/src/libraries/util/output/ConsoleWriter.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/ConsoleWriter.cc	(revision 8858)
@@ -0,0 +1,107 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the ConsoleWriter singleton.
+*/
+
+#include "ConsoleWriter.h"
+
+#include <iostream>
+
+#include "OutputManager.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor, initializes the output level.
+
+        In debug builds, it writes output up to level::internal_warning to the
+        console, in release builds only up to level::user_info.
+
+        After creation, the instance is enabled.
+    */
+    ConsoleWriter::ConsoleWriter() : BaseWriter("Console")
+    {
+#ifdef ORXONOX_RELEASE
+        this->setLevelMax(level::user_info);
+#else
+        this->setLevelMax(level::internal_warning);
+#endif
+        this->bEnabled_ = true;
+    }
+
+    /**
+        @brief Destructor.
+    */
+    ConsoleWriter::~ConsoleWriter()
+    {
+    }
+
+    /**
+        @brief Returns the only existing instance of this class.
+    */
+    /*static*/ ConsoleWriter& ConsoleWriter::getInstance()
+    {
+        static ConsoleWriter instance;
+        return instance;
+    }
+
+    /**
+        @brief Inherited function from BaseWriter, writes output to the console using std::cout.
+    */
+    void ConsoleWriter::printLine(const std::string& line, OutputLevel)
+    {
+        std::cout << line << std::endl;
+    }
+
+    /**
+        @brief Enables the instance by registering itself as listener at OutputManager.
+    */
+    void ConsoleWriter::enable()
+    {
+        if (!this->bEnabled_)
+        {
+            OutputManager::getInstance().registerListener(this);
+            this->bEnabled_ = true;
+        }
+    }
+
+    /**
+        @brief Disables the instance by unregistering itself from OutputManager.
+    */
+    void ConsoleWriter::disable()
+    {
+        if (this->bEnabled_)
+        {
+            OutputManager::getInstance().unregisterListener(this);
+            this->bEnabled_ = false;
+        }
+    }
+}
Index: code/trunk/src/libraries/util/output/ConsoleWriter.h
===================================================================
--- code/trunk/src/libraries/util/output/ConsoleWriter.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/ConsoleWriter.h	(revision 8858)
@@ -0,0 +1,69 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the ConsoleWriter singleton which is used to write output to the console.
+*/
+
+#ifndef _ConsoleWriter_H__
+#define _ConsoleWriter_H__
+
+#include "util/UtilPrereqs.h"
+#include "BaseWriter.h"
+
+namespace orxonox
+{
+    /**
+        @brief ConsoleWriter inherits from BaseWriter and writes output to the console.
+
+        This class can be seen as an equivalent to std::cout within the output
+        system. It is implemented as a singleton for static acces.
+    */
+    class _UtilExport ConsoleWriter : public BaseWriter
+    {
+        public:
+            static ConsoleWriter& getInstance();
+
+            void enable();
+            void disable();
+
+        protected:
+            virtual void printLine(const std::string& line, OutputLevel level);
+
+        private:
+            ConsoleWriter();
+            ConsoleWriter(const ConsoleWriter&);
+            virtual ~ConsoleWriter();
+
+            bool bEnabled_; ///< If false, the instance will not write output to the console.
+    };
+}
+
+#endif /* _ConsoleWriter_H__ */
Index: code/trunk/src/libraries/util/output/LogWriter.cc
===================================================================
--- code/trunk/src/libraries/util/output/LogWriter.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/LogWriter.cc	(revision 8858)
@@ -0,0 +1,157 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the LogWriter singleton.
+*/
+
+#include "LogWriter.h"
+
+#include <ctime>
+#include <cstdlib>
+
+#include "OutputManager.h"
+#include "MemoryWriter.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor, initializes the desired output levels and the name and path of the log-file, and opens the log-file.
+
+        By default, LogWriter receives all output up to level::internal_info.
+        The log-file has a default name which usually doesn't change. The path
+        is initialized with a temporary directory, depending on the system,
+        and can be changed later.
+    */
+    LogWriter::LogWriter() : BaseWriter("Log")
+    {
+        this->setLevelMax(level::internal_info);
+
+        this->filename_ = "orxonox.log";
+
+        // get the path for a temporary file, depending on the system
+#ifdef ORXONOX_PLATFORM_WINDOWS
+        this->path_ = getenv("TEMP");
+#else
+        this->path_ = "/tmp";
+#endif
+        this->bDefaultPath_ = true;
+
+        this->openFile();
+    }
+
+    /**
+        @brief Destructor, closes the log-file.
+    */
+    LogWriter::~LogWriter()
+    {
+        this->closeFile();
+    }
+
+    /**
+        @brief Returns the only existing instance of this class.
+    */
+    /*static*/ LogWriter& LogWriter::getInstance()
+    {
+        static LogWriter instance;
+        return instance;
+    }
+
+    /**
+        @brief Opens the log-file in order to write output to it.
+    */
+    void LogWriter::openFile()
+    {
+        // get the full file-name
+        std::string name = this->path_ + '/' + this->filename_;
+
+        // if we open the log file in the default directory, send a message to the user so that he can find the file in the case of a crash.
+        if (this->bDefaultPath_)
+            OutputManager::getInstance().pushMessage(level::user_info, context::undefined(), "Opening log file " + name);
+
+        // open the file
+        this->file_.open(name.c_str(), std::fstream::out);
+
+        // check if it worked and print some output
+        if (this->file_.is_open())
+            this->printLine("Log file opened", level::none);
+        else
+            OutputManager::getInstance().pushMessage(level::user_warning, context::undefined(), "Failed to open log file. File logging disabled.");
+    }
+
+    /**
+        @brief Closes the log-file.
+    */
+    void LogWriter::closeFile()
+    {
+        if (this->file_.is_open())
+        {
+            this->printLine("Log file closed", level::none);
+            this->file_.close();
+        }
+    }
+
+    /**
+        @brief Changes the path of the log-file. Re-writes the log-file by using MemoryWriter.
+    */
+    void LogWriter::setLogPath(const std::string& path)
+    {
+        // notify about the change of the log-file (because the old file will no longer be updated)
+        OutputManager::getInstance().pushMessage(level::internal_info, context::undefined(), "Migrating log file from " + this->path_ + "\nto " + path);
+
+        // close the old file, update the path and open the new file
+        this->closeFile();
+        this->path_ = path;
+        this->bDefaultPath_ = false;
+        this->openFile();
+
+        // request old output from MemoryWriter
+        MemoryWriter::getInstance().resendOutput(this);
+    }
+
+    /**
+        @brief Inherited function from BaseWriter, writers output together with a timestamp to the log-file.
+    */
+    void LogWriter::printLine(const std::string& line, OutputLevel)
+    {
+        if (!this->file_.is_open())
+            return;
+
+        // get the current time
+        time_t rawtime;
+        struct tm* timeinfo;
+        time(&rawtime);
+        timeinfo = localtime(&rawtime);
+
+        // print timestamp and output line to the log file
+        this->file_ << (timeinfo->tm_hour < 10 ? "0" : "") << timeinfo->tm_hour << ':' <<
+                       (timeinfo->tm_min  < 10 ? "0" : "") << timeinfo->tm_min  << ':' <<
+                       (timeinfo->tm_sec  < 10 ? "0" : "") << timeinfo->tm_sec  << ' ' << line << std::endl;
+    }
+}
Index: code/trunk/src/libraries/util/output/LogWriter.h
===================================================================
--- code/trunk/src/libraries/util/output/LogWriter.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/LogWriter.h	(revision 8858)
@@ -0,0 +1,82 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the LogWriter singleton which writes output to a log-file.
+*/
+
+#ifndef _LogWriter_H__
+#define _LogWriter_H__
+
+#include "util/UtilPrereqs.h"
+
+#include <fstream>
+
+#include "BaseWriter.h"
+
+namespace orxonox
+{
+    /**
+        @brief The LogWriter class inherits from BaseWriter and writes output to a log-file.
+
+        It is implemented as singleton because we (currently) use only one
+        log-file. The path of the file can be changed, in which case the file
+        is rewritten by using the output stored by MemoryWriter. This adds the
+        possibility to change the desired output levels before changing the
+        path in order to get the complete output with the new output levels
+        at the new path.
+    */
+    class _UtilExport LogWriter : public BaseWriter
+    {
+        public:
+            static LogWriter& getInstance();
+
+            void setLogPath(const std::string& path);
+
+        protected:
+            virtual void printLine(const std::string& line, OutputLevel level);
+
+        private:
+            LogWriter();
+            LogWriter(const LogWriter&);
+            virtual ~LogWriter();
+
+            void openFile();
+            void closeFile();
+
+            std::string filename_;  ///< The name of the log-file (without directories)
+            std::string path_;      ///< The path of the log-file (without file-name)
+            bool bDefaultPath_;     ///< If true, the log-file resides at the default path (which is usually a temporary directory)
+
+            std::ofstream file_;    ///< The output file stream.
+    };
+}
+
+#endif /* _LogWriter_H__ */
Index: code/trunk/src/libraries/util/output/MemoryWriter.cc
===================================================================
--- code/trunk/src/libraries/util/output/MemoryWriter.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/MemoryWriter.cc	(revision 8858)
@@ -0,0 +1,91 @@
+/*
+ *   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:
+ *      Reto Grieder
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the MemoryWriter singleton.
+*/
+
+#include "MemoryWriter.h"
+#include "OutputManager.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor, initializes the level mask with all levels activated.
+    */
+    MemoryWriter::MemoryWriter()
+    {
+        this->setLevelMask(level::all);
+    }
+
+    /**
+        @brief Destructor.
+    */
+    MemoryWriter::~MemoryWriter()
+    {
+    }
+
+    /**
+        @brief Returns the only existing instance of this singleton class.
+    */
+    /*static*/ MemoryWriter& MemoryWriter::getInstance()
+    {
+        static MemoryWriter instance;
+        return instance;
+    }
+
+    /**
+        @brief Implementation of the output() function inherited from OutputListener, stores the received output in memory.
+    */
+    void MemoryWriter::output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
+    {
+        this->messages_.push_back(Message(level, context, lines));
+    }
+
+    /**
+        @brief Iterates over all stored output messages and sends them to the OutputListener.
+    */
+    void MemoryWriter::resendOutput(OutputListener* listener) const
+    {
+        for (size_t i = 0; i < this->messages_.size(); ++i)
+        {
+            const Message& message = this->messages_[i];
+            listener->unfilteredOutput(message.level, *message.context, message.lines);
+        }
+    }
+
+    /**
+        @brief Unregisters the instance from OutputManager, hence it will not receive any further output.
+    */
+    void MemoryWriter::disable()
+    {
+        OutputManager::getInstance().unregisterListener(this);
+        this->output(level::debug_output, context::undefined(), std::vector<std::string>(1, "MemoryWriter disabled, further messages may be lost"));
+    }
+}
Index: code/trunk/src/libraries/util/output/MemoryWriter.h
===================================================================
--- code/trunk/src/libraries/util/output/MemoryWriter.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/MemoryWriter.h	(revision 8858)
@@ -0,0 +1,86 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the MemoryWriter singleton.
+*/
+
+#ifndef _MemoryWriter_H__
+#define _MemoryWriter_H__
+
+#include "util/UtilPrereqs.h"
+#include "OutputListener.h"
+
+namespace orxonox
+{
+    /**
+        @brief MemoryWriter is a singleton which is derived from OutputListener and writes all output to a list.
+
+        This list can be used to re-send old output to other instances of
+        OutputListener, e.g. if they were newly created or to re-write the
+        log-file.
+
+        Since MemoryWriter receives output of all levels, this means also that
+        all possible output needs to be generated as long as MemoryWriter stays
+        active. Hence disable() should be called as soon as possible.
+    */
+    class _UtilExport MemoryWriter : public OutputListener
+    {
+        /// @brief A helper struct which is used to store output and its properties.
+        struct Message
+        {
+            /// @brief Constructor, assigns all values.
+            Message(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
+                : level(level), context(&context), lines(lines) {}
+
+            OutputLevel level;                      ///< The level of the output message
+            const OutputContextContainer* context;  ///< The context of the output message
+            std::vector<std::string> lines;         ///< The lines of text of the output message
+        };
+
+        public:
+            static MemoryWriter& getInstance();
+
+            void resendOutput(OutputListener* listener) const;
+            void disable();
+
+        protected:
+            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines);
+
+        private:
+            MemoryWriter();
+            MemoryWriter(const MemoryWriter&);
+            virtual ~MemoryWriter();
+
+            std::vector<Message> messages_; ///< Stores all output messages from the creation of this instance until disable() is called.
+    };
+}
+
+#endif /* _MemoryWriter_H__ */
Index: code/trunk/src/libraries/util/output/OutputDefinitions.h
===================================================================
--- code/trunk/src/libraries/util/output/OutputDefinitions.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/OutputDefinitions.h	(revision 8858)
@@ -0,0 +1,166 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Defines output levels and output contexts.
+*/
+
+#ifndef _OutputDefinitions_H__
+#define _OutputDefinitions_H__
+
+#include "util/UtilPrereqs.h"
+#include <string>
+
+/**
+    @brief Defines a context function with a given name.
+    @param name Name of the context
+
+    Context functions return a reference to a OutputContextContainer. Context
+    functions (or the containers they return) can be passed to orxout() as
+    context argument.
+*/
+#define REGISTER_OUTPUT_CONTEXT(name) \
+    const OutputContextContainer& name() { static const OutputContextContainer& context = registerContext(#name); return context; }
+
+/**
+    @brief Defines a sub-context.
+    @param name Name of the main-context
+    @param subname Name of the sub-context
+
+    Sub-contexts act like normal contexts, except that multiple sub-contexts
+    share the context mask of their main-context. This allows contexts with
+    more descriptive names (e.g. input::keyboard) and they can be filtered
+    individually by derivatives of orxonox::SubcontextOutputListener.
+*/
+#define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
+    const OutputContextContainer& subname() { static const OutputContextContainer& context = registerContext(#name, #subname); return context; }
+
+// tolua_begin
+namespace orxonox
+{
+    namespace level
+    {
+        /**
+            @brief Output levels define type and importance of an output message.
+            They can be passed to the orxout() function as level argument.
+        */
+        enum OutputLevel
+        {
+            all              = 0xFFFF, ///< Level mask with all bits set to 1
+            none             = 0x0000, ///< Level mask with all bits set to 0
+
+            message          = 0x0001, ///< Output level, used for messages directed to the user (e.g. "Press any key to continue")
+            debug_output     = 0x0002, ///< Output level, used for temporary debug output while writing code
+            user_error       = 0x0004, ///< Output level, used for error messages which are important for the user
+            user_warning     = 0x0008, ///< Output level, used for warnings which are important for the user
+            user_status      = 0x0010, ///< Output level, used to notify the user about the program's state
+            user_info        = 0x0020, ///< Output level, used to provide the user with additional progress information
+            internal_error   = 0x0040, ///< Output level, used for error messages which are important for developers
+            internal_warning = 0x0080, ///< Output level, used for warnings which are important for developers
+            internal_status  = 0x0100, ///< Output level, used to log the program's internal state in the log file
+            internal_info    = 0x0200, ///< Output level, used to log information about the program's progress in the log file
+            verbose          = 0x0400, ///< Output level, usually not visible, used for unimportant debug information
+            verbose_more     = 0x0800, ///< Output level, usually not visible, used for unimportant debug information (less important than verbose)
+            verbose_ultra    = 0x1000  ///< Output level, usually not visible, used for unimportant debug information (even less important than verbose_more)
+        };
+    }
+// tolua_end
+
+    using namespace level;
+
+    typedef uint64_t OutputContextMask;  ///< Used to store the context masks. Each bit defines a context.
+    typedef uint16_t OutputContextSubID; ///< Used to store the IDs of sub-contexts. Each number except context::no_subcontext defines a sub-context.
+
+    /// @brief Stores all information about a context.
+    struct OutputContextContainer
+    {
+        OutputContextMask mask;     ///< The mask of the context (or the mask of the main-context if this container defines a sub-context)
+        OutputContextSubID sub_id;  ///< The id of the sub-context (or context::no_subcontext if this container doesn't define a sub-context)
+        std::string name;           ///< The name of this context
+    };
+
+    typedef const OutputContextContainer& (OutputContextFunction)();
+
+    /**
+        @brief Registers a context.
+        This is a shortcut to OutputManager::registerContext() to avoid the inclusion of its header file.
+    */
+    extern _UtilExport const OutputContextContainer& registerContext(const std::string& name, const std::string& subname = "");
+
+    namespace context
+    {
+        static const OutputContextMask all       = 0xFFFFFFFFFFFFFFFF; ///< Context mask, all bits set to 1
+        static const OutputContextMask none      = 0x0000000000000000; ///< Context mask, all bits set to 0
+
+        static const OutputContextSubID no_subcontext = 0; ///< Used as ID for contexts which are not sub-contexts
+
+        namespace
+        {
+            REGISTER_OUTPUT_CONTEXT(undefined); ///< "undefined" context which is implicitly used for all output that has no explicit context
+
+            REGISTER_OUTPUT_CONTEXT(ogre);
+            REGISTER_OUTPUT_CONTEXT(cegui);
+            REGISTER_OUTPUT_CONTEXT(lua);
+            REGISTER_OUTPUT_CONTEXT(tcl);
+            REGISTER_OUTPUT_CONTEXT(identifier);
+            REGISTER_OUTPUT_CONTEXT(object_list);
+            REGISTER_OUTPUT_CONTEXT(super);
+            REGISTER_OUTPUT_CONTEXT(language);
+            REGISTER_OUTPUT_CONTEXT(commands);
+            REGISTER_OUTPUT_CONTEXT(input);
+            REGISTER_OUTPUT_CONTEXT(events);
+            REGISTER_OUTPUT_CONTEXT(config);
+            REGISTER_OUTPUT_CONTEXT(templates);
+            REGISTER_OUTPUT_CONTEXT(loader);
+            REGISTER_OUTPUT_CONTEXT(xml);
+            REGISTER_OUTPUT_CONTEXT(network);
+            REGISTER_OUTPUT_CONTEXT(packets);
+            REGISTER_OUTPUT_CONTEXT(master_server);
+            REGISTER_OUTPUT_CONTEXT(sound);
+            REGISTER_OUTPUT_CONTEXT(lod);
+            REGISTER_OUTPUT_CONTEXT(pickups);
+            REGISTER_OUTPUT_CONTEXT(quests);
+            REGISTER_OUTPUT_CONTEXT(notifications);
+            REGISTER_OUTPUT_CONTEXT(triggers);
+            REGISTER_OUTPUT_CONTEXT(docking);
+
+            namespace misc
+            {
+                REGISTER_OUTPUT_SUBCONTEXT(misc, executor);
+                REGISTER_OUTPUT_SUBCONTEXT(misc, factory);
+                REGISTER_OUTPUT_SUBCONTEXT(misc, gui);
+                REGISTER_OUTPUT_SUBCONTEXT(misc, overlays);
+                REGISTER_OUTPUT_SUBCONTEXT(misc, script);
+            }
+        }
+    }
+} // tolua_export
+
+#endif /* _OutputDefinitions_H__ */
Index: code/trunk/src/libraries/util/output/OutputListener.cc
===================================================================
--- code/trunk/src/libraries/util/output/OutputListener.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/OutputListener.cc	(revision 8858)
@@ -0,0 +1,149 @@
+/*
+ *   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
+    @brief Implementation of the OutputListener class.
+*/
+
+#include "OutputListener.h"
+
+#include "OutputManager.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor, initializes the values and registers the instance at OutputManager if requested.
+        @param bRegister If \c true, the instance is automatically registered at OutputManager.
+                         Should be \c false if the constructor of the derived class generates output.
+    */
+    OutputListener::OutputListener(bool bRegister)
+    {
+        this->levelMask_ = level::none;
+        this->additionalContextsLevelMask_ = level::none;
+        this->additionalContextsMask_ = context::none;
+
+        if (bRegister)
+            OutputManager::getInstance().registerListener(this);
+    }
+
+    /**
+        @brief Destructor, unregisters the instance from OutputManager.
+    */
+    OutputListener::~OutputListener()
+    {
+        OutputManager::getInstance().unregisterListener(this);
+    }
+
+    /**
+        @brief Defines the level mask in a way which accepts all output up to the level \c max.
+    */
+    void OutputListener::setLevelMax(OutputLevel max)
+    {
+        this->setLevelRange(static_cast<OutputLevel>(0x1), max);
+    }
+
+    /**
+        @brief Defines the level mask in a way which accepts all output between the levels \c min and \c max.
+    */
+    void OutputListener::setLevelRange(OutputLevel min, OutputLevel max)
+    {
+        int mask = 0;
+        for (int level = min; level <= max; level = level << 1)
+            mask |= level;
+
+        this->setLevelMask(static_cast<OutputLevel>(mask));
+    }
+
+    /**
+        @brief Defines the level mask.
+    */
+    void OutputListener::setLevelMask(OutputLevel mask)
+    {
+        this->levelMask_ = mask;
+
+        OutputManager::getInstance().updateCombinedLevelMask();
+    }
+
+    /**
+        @brief Defines the level mask of additional contexts in a way which accepts all output up to the level \c max.
+    */
+    void OutputListener::setAdditionalContextsLevelMax(OutputLevel max)
+    {
+        this->setAdditionalContextsLevelRange(static_cast<OutputLevel>(0x1), max);
+    }
+
+    /**
+        @brief Defines the level mask of additional contexts in a way which accepts all output between the levels \c min and \c max.
+    */
+    void OutputListener::setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max)
+    {
+        int mask = 0;
+        for (int level = min; level <= max; level = level << 1)
+            mask |= level;
+
+        this->setAdditionalContextsLevelMask(static_cast<OutputLevel>(mask));
+    }
+
+    /**
+        @brief Defines the level mask of additional contexts.
+    */
+    void OutputListener::setAdditionalContextsLevelMask(OutputLevel mask)
+    {
+        this->additionalContextsLevelMask_ = mask;
+
+        OutputManager::getInstance().updateCombinedAdditionalContextsLevelMask();
+    }
+
+    /**
+        @brief Defines the mask of additional contexts.
+    */
+    void OutputListener::setAdditionalContextsMask(OutputContextMask mask)
+    {
+        this->additionalContextsMask_ = mask;
+
+        OutputManager::getInstance().updateCombinedAdditionalContextsMask();
+    }
+
+    /**
+        @brief Returns true if this listener accepts output of the given level and context, based on the levels and contexts masks.
+    */
+    bool OutputListener::acceptsOutput(OutputLevel level, const OutputContextContainer& context) const
+    {
+        // check if the output level is accepted by the level mask (independent of the context)
+        if (this->levelMask_ & level)
+            return true;
+
+        // check if the output context is accepted by the additional context mask and if the level matches as well
+        if ((this->additionalContextsMask_ & context.mask) && (this->additionalContextsLevelMask_ & level))
+            return true;
+
+        // otherwise we don't accept the output
+        return false;
+    }
+}
Index: code/trunk/src/libraries/util/output/OutputListener.h
===================================================================
--- code/trunk/src/libraries/util/output/OutputListener.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/OutputListener.h	(revision 8858)
@@ -0,0 +1,174 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the OutputListener interface which receives output
+    from orxonox::OutputManager.
+*/
+
+#ifndef _OutputListener_H__
+#define _OutputListener_H__
+
+#include "util/UtilPrereqs.h"
+
+#include <vector>
+
+#include "OutputDefinitions.h"
+
+namespace orxonox
+{
+    /**
+        @brief OutputListener is an interface which is used to receive output of a certain level and context from OutputManager.
+    */
+    //  See below the class declaration for a more detailed description.
+    class _UtilExport OutputListener
+    {
+        public:
+            OutputListener(bool bRegister = true);
+            virtual ~OutputListener();
+
+            void setLevelMax(OutputLevel max);
+            void setLevelRange(OutputLevel min, OutputLevel max);
+            void setLevelMask(OutputLevel mask);
+
+            void setAdditionalContextsLevelMax(OutputLevel max);
+            void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max);
+            void setAdditionalContextsLevelMask(OutputLevel mask);
+
+            void setAdditionalContextsMask(OutputContextMask mask);
+
+            /// @brief Returns the level mask.
+            inline OutputLevel getLevelMask() const
+                { return this->levelMask_; }
+            /// @brief Returns the additional contexts mask.
+            inline OutputContextMask getAdditionalContextsMask() const
+                { return this->additionalContextsMask_; }
+            /// @brief Returns the additional contexts level mask.
+            inline OutputLevel getAdditionalContextsLevelMask() const
+                { return this->additionalContextsLevelMask_; }
+
+            virtual bool acceptsOutput(OutputLevel level, const OutputContextContainer& context) const;
+
+            /// @brief Called by OutputManager for each line of output, checks if this listener actually accepts this output before it calls the output() function.
+            inline void unfilteredOutput(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
+                { if (this->acceptsOutput(level, context)) this->output(level, context, lines); }
+
+        protected:
+            /// @brief Pure virtual function, needs to be implemented in order to receive output.
+            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines) = 0;
+
+        private:
+            OutputLevel       levelMask_;                   ///< Mask of accepted output levels, independent of contexts
+            OutputContextMask additionalContextsMask_;      ///< Mask of accepted additional contexts
+            OutputLevel       additionalContextsLevelMask_; ///< Mask of accepted output levels of the additional contexts
+    };
+
+    /**
+        @class OutputListener
+
+        An instance of OutputListener registers itself at OutputManager and
+        declares the desired output levels and contexts. OutputManager will
+        then send output to it by calling the output() function.
+
+        OutputListener has 3 masks to define the desired output. These masks
+        can be used in two different ways (or as a combination of both):
+        \li 1. By defining the \a "level mask": The OutputListener will then
+               receive all output of these levels independent of the context.
+        \li 2. By defining the \a "additional contexts mask" and the
+               \a "additional contexts level mask": This way the listener
+               receives only output of a particular context and level.
+        \li 3. By using all 3 masks which combines the output defined by the
+               first two ways.
+
+        This can be illustrated as follows:
+
+        1. Only level mask:
+        \li level-mask = error | warning;
+
+        @verbatim
+                |   Contexts:   |
+                | A | B | C | D |
+        --------|---|---|---|---|
+        debug   | - | - | - | - |
+        --------|---|---|---|---|
+        error   | x | x | x | x |
+        --------|---|---|---|---|       [x] Receives output
+        warning | x | x | x | x |       [-] Does not receive output
+        --------|---|---|---|---|
+        status  | - | - | - | - |
+        --------|---|---|---|---|
+        verbose | - | - | - | - |
+        --------|---|---|---|---|
+        @endverbatim
+
+        2. Only additional contexts:
+        \li additional-contexts-mask = B | D;
+        \li additional-contexts-level-mask = debug | verbose;
+
+        @verbatim
+                |   Contexts:   |
+                | A | B | C | D |
+        --------|---|---|---|---|
+        debug   | - | x | - | x |
+        --------|---|---|---|---|
+        error   | - | - | - | - |
+        --------|---|---|---|---|       [x] Receives output
+        warning | - | - | - | - |       [-] Does not receive output
+        --------|---|---|---|---|
+        status  | - | - | - | - |
+        --------|---|---|---|---|
+        verbose | - | x | - | x |
+        --------|---|---|---|---|
+        @endverbatim
+
+        3. Both level mask plus additional contexts:
+        \li level-mask = error | warning;
+        \li additional-contexts-mask = B | D;
+        \li additional-contexts-level-mask = debug | verbose;
+
+        @verbatim
+                |   Contexts:   |
+                | A | B | C | D |
+        --------|---|---|---|---|
+        debug   | - | x | - | x |
+        --------|---|---|---|---|
+        error   | x | x | x | x |
+        --------|---|---|---|---|       [x] Receives output
+        warning | x | x | x | x |       [-] Does not receive output
+        --------|---|---|---|---|
+        status  | - | - | - | - |
+        --------|---|---|---|---|
+        verbose | - | x | - | x |
+        --------|---|---|---|---|
+        @endverbatim
+    */
+}
+
+#endif /* _OutputListener_H__ */
Index: code/trunk/src/libraries/util/output/OutputManager.cc
===================================================================
--- code/trunk/src/libraries/util/output/OutputManager.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/OutputManager.cc	(revision 8858)
@@ -0,0 +1,277 @@
+/*
+ *   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
+    @brief Implementation of the OutputManager singleton.
+*/
+
+#include "OutputManager.h"
+
+#include "MemoryWriter.h"
+#include "ConsoleWriter.h"
+#include "LogWriter.h"
+#include "util/Output.h"
+#include "util/StringUtils.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor, initializes all values.
+    */
+    OutputManager::OutputManager()
+    {
+        this->combinedLevelMask_ = level::none;
+        this->combinedAdditionalContextsLevelMask_ = level::none;
+        this->combinedAdditionalContextsMask_ = context::none;
+
+        this->subcontextCounter_ = 0;
+    }
+
+    /**
+        @brief Destructor.
+    */
+    OutputManager::~OutputManager()
+    {
+    }
+
+    /**
+        @brief Returns the only existing instance of the OutputManager singleton.
+    */
+    /*static*/ OutputManager& OutputManager::getInstance()
+    {
+        static OutputManager instance;
+        return instance;
+    }
+
+    /**
+        @brief Returns the only existing instance of the OutputManager singleton
+        and ensures that the most important output listeners exist.
+
+        You should use this function if you send output to OutputManager and want
+        to be sure that the most important output listeners exist. Don't use it
+        elsewhere inside the output system to avoid circular calls.
+    */
+    /*static*/ OutputManager& OutputManager::getInstanceAndCreateListeners()
+    {
+        static OutputManager& instance = OutputManager::getInstance();
+
+        static MemoryWriter& memoryWriterInstance = MemoryWriter::getInstance(); (void)memoryWriterInstance;
+        static ConsoleWriter& consoleWriterInstance = ConsoleWriter::getInstance(); (void)consoleWriterInstance;
+        static LogWriter& logWriterInstance = LogWriter::getInstance(); (void)logWriterInstance;
+
+        return instance;
+    }
+
+    /**
+        @brief Sends an output message to all output listeners.
+        @param level The level of the message
+        @param context The context of the message
+        @param message The output message (may contain '\\n')
+
+        This function splits the message into lines (if it contains '\\n') and
+        sends it to the output listeners. They may ignore the message if it
+        doesn't match their level- and context-masks.
+    */
+    void OutputManager::pushMessage(OutputLevel level, const OutputContextContainer& context, const std::string& message)
+    {
+        std::vector<std::string> lines;
+        vectorize(message, '\n', &lines);
+
+        for (size_t i = 0; i < this->listeners_.size(); ++i)
+            this->listeners_[i]->unfilteredOutput(level, context, lines);
+    }
+
+    /**
+        @brief Adds an output listener to the list of listeners.
+    */
+    void OutputManager::registerListener(OutputListener* listener)
+    {
+        this->listeners_.push_back(listener);
+        this->updateMasks();
+    }
+
+    /**
+        @brief Removes an output listener from the list of listeners.
+    */
+    void OutputManager::unregisterListener(OutputListener* listener)
+    {
+        for (std::vector<OutputListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+        {
+            if (*it == listener)
+            {
+                this->listeners_.erase(it);
+                break;
+            }
+        }
+        this->updateMasks();
+    }
+
+    /**
+        @brief Updates all three combined level- and context-masks.
+    */
+    void OutputManager::updateMasks()
+    {
+        this->updateCombinedLevelMask();
+        this->updateCombinedAdditionalContextsLevelMask();
+        this->updateCombinedAdditionalContextsMask();
+    }
+
+    /**
+        @brief Updates the combined level mask. The masks of all listeners are ORed to form the combined mask.
+    */
+    void OutputManager::updateCombinedLevelMask()
+    {
+        int mask = 0;
+        for (size_t i = 0; i < this->listeners_.size(); ++i)
+            mask |= this->listeners_[i]->getLevelMask();
+        this->combinedLevelMask_ = static_cast<OutputLevel>(mask);
+    }
+
+    /**
+        @brief Updates the combined additional contexts level mask. The masks of all listeners are ORed to form the combined mask.
+    */
+    void OutputManager::updateCombinedAdditionalContextsLevelMask()
+    {
+        int mask = 0;
+        for (size_t i = 0; i < this->listeners_.size(); ++i)
+            mask |= this->listeners_[i]->getAdditionalContextsLevelMask();
+        this->combinedAdditionalContextsLevelMask_ = static_cast<OutputLevel>(mask);
+    }
+
+    /**
+        @brief Updates the combined additional contexts mask. The masks of all listeners are ORed to form the combined mask.
+    */
+    void OutputManager::updateCombinedAdditionalContextsMask()
+    {
+        this->combinedAdditionalContextsMask_ = 0;
+        for (size_t i = 0; i < this->listeners_.size(); ++i)
+            this->combinedAdditionalContextsMask_ |= this->listeners_[i]->getAdditionalContextsMask();
+    }
+
+    /**
+        @brief Registers a context (or sub-context) and returns the container which identifies the context.
+        @param name The name of the context
+        @param subname The name of the sub-context (or "" if it is not a sub-context)
+
+        If the context doesn't exist, it gets created. Otherwise the existing instance is returned.
+    */
+    const OutputContextContainer& OutputManager::registerContext(const std::string& name, const std::string& subname)
+    {
+        // the full name of a context is a combination of name and subname with "::" in between
+        std::string full_name = name;
+        if (subname != "")
+            full_name += "::" + subname;
+
+        // check if the context already exists (and return it if it does)
+        std::map<std::string, OutputContextContainer>::iterator it_container = this->contextContainers_.find(full_name);
+        if (it_container != this->contextContainers_.end())
+            return it_container->second;
+
+        // create a new context container
+        OutputContextContainer container;
+        container.name = full_name;
+
+        // check if the mask of the main-context already exists
+        std::map<std::string, OutputContextMask>::iterator it_mask = this->contextMasks_.find(name);
+        if (it_mask != this->contextMasks_.end())
+        {
+            // the mask exists, assign it to the container
+            container.mask = it_mask->second;
+        }
+        else
+        {
+            // the mask doesn't exist, create it. It's a binary mask. The n-th main-context is defined by the n-th bit in the mask.
+            container.mask = static_cast<OutputContextMask>(0x1) << this->contextMasks_.size();
+            this->contextMasks_[name] = container.mask;
+
+            if (container.mask == 0)
+                orxout(internal_warning) << "More than " << sizeof(OutputContextMask) * 8 << " output contexts defined. Context '" << name << "' might not get filtered correctly" << endl;
+        }
+
+        // if the context is a sub-context, assign a unique ID.
+        if (subname == "")
+            container.sub_id = context::no_subcontext;
+        else
+            container.sub_id = ++this->subcontextCounter_; // start with 1
+
+        // add the new context to the map and return it
+        return (this->contextContainers_[full_name] = container);
+    }
+
+    /**
+        @brief Static function, shortcut to OutputManager::registerContext().
+        The function is declared in OutputDefinitions.h.
+    */
+    const OutputContextContainer& registerContext(const std::string& name, const std::string& subname)
+    {
+        return OutputManager::getInstance().registerContext(name, subname);
+    }
+
+    /**
+        @brief Returns a human readable string for each output level.
+    */
+    const std::string& OutputManager::getLevelName(OutputLevel level) const
+    {
+        switch (level)
+        {
+            // using static cache variables for speed
+            case level::none:               { static std::string name = "None"; return name; }
+            case level::message:            { static std::string name = "Message"; return name; }
+            case level::debug_output:       { static std::string name = "Debug"; return name; }
+            case level::user_error:         { static std::string name = "Error"; return name; }
+            case level::user_warning:       { static std::string name = "Warning"; return name; }
+            case level::user_status:        { static std::string name = "Status"; return name; }
+            case level::user_info:          { static std::string name = "Info"; return name; }
+            case level::internal_error:     { static std::string name = "Error (internal)"; return name; }
+            case level::internal_warning:   { static std::string name = "Warning (internal)"; return name; }
+            case level::internal_status:    { static std::string name = "Status (internal)"; return name; }
+            case level::internal_info:      { static std::string name = "Info (internal)"; return name; }
+            case level::verbose:            { static std::string name = "Verbose"; return name; }
+            case level::verbose_more:       { static std::string name = "Verbose (more)"; return name; }
+            case level::verbose_ultra:      { static std::string name = "Verbose (ultra)"; return name; }
+            default:                        { static std::string name = ""; return name; }
+        }
+    }
+
+    /**
+        @brief Returns a string containing the name of the level and the context (if any) which
+        can be prepended to an output message if it is written to the console or the log file.
+    */
+    std::string OutputManager::getDefaultPrefix(OutputLevel level, const OutputContextContainer& context) const
+    {
+        // "undefined" context is ignored because it's used implicitly if no explicit context is defined
+        static OutputContextMask undefined_mask = context::undefined().mask;
+
+        std::string prefix = this->getLevelName(level) + ": ";
+        if (context.mask != undefined_mask)
+            prefix += "[" + context.name + "] ";
+
+        return prefix;
+    }
+}
Index: code/trunk/src/libraries/util/output/OutputManager.h
===================================================================
--- code/trunk/src/libraries/util/output/OutputManager.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/OutputManager.h	(revision 8858)
@@ -0,0 +1,114 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the OutputManager class which receives output from orxonox::OutputStream
+    and distributes it to all instances of orxonox::OutputListener.
+*/
+
+#ifndef _OutputManager_H__
+#define _OutputManager_H__
+
+#include "util/UtilPrereqs.h"
+
+#include <vector>
+#include <map>
+
+#include "OutputDefinitions.h"
+
+namespace orxonox
+{
+    /**
+        @brief OutputManager acts as the center of the output system and is implemented as a singleton.
+
+        All instances of OutputStream (and hence also the orxout() function)
+        send their buffered output to OutputManager. OutputManager then
+        distributes this output to all registered instances of OutputListener.
+
+        For each listener OutputManager checks if it wants to receive output
+        with the given level and context. OutputManager itself also maintains
+        masks that define the accepted levels and concept. They are a
+        combination of the masks of all output listeners. See the description
+        of OutputListener for a more conclusive description of these masks.
+
+        Additionally OutputManager is used to register output contexts.
+    */
+    class _UtilExport OutputManager
+    {
+        public:
+            static OutputManager& getInstance();
+            static OutputManager& getInstanceAndCreateListeners();
+
+            void pushMessage(OutputLevel level, const OutputContextContainer& context, const std::string& message);
+
+            void registerListener(OutputListener* listener);
+            void unregisterListener(OutputListener* listener);
+
+            void updateMasks();
+            void updateCombinedLevelMask();
+            void updateCombinedAdditionalContextsLevelMask();
+            void updateCombinedAdditionalContextsMask();
+
+            /**
+                @brief Returns true if at least one of the output listeners will accept output with the given level and context.
+
+                For the sake of performance, output messages with levels or
+                contexts that are not accepted should be ignored or, even
+                better, not generated at all.
+            */
+            inline bool acceptsOutput(OutputLevel level, const OutputContextContainer& context) const
+            {
+                return (this->combinedLevelMask_ & level) ||
+                       ((this->combinedAdditionalContextsLevelMask_ & level) && (this->combinedAdditionalContextsMask_ & context.mask));
+            }
+
+            const OutputContextContainer& registerContext(const std::string& name, const std::string& subname = "");
+
+            const std::string& getLevelName(OutputLevel level) const;
+            std::string getDefaultPrefix(OutputLevel level, const OutputContextContainer& context) const;
+
+        private:
+            OutputManager();
+            OutputManager(const OutputManager&);
+            ~OutputManager();
+
+            std::vector<OutputListener*> listeners_;                            ///< List of all registered output listeners
+
+            OutputLevel       combinedLevelMask_;                               ///< The combined mask of accepted levels of all listeners
+            OutputLevel       combinedAdditionalContextsLevelMask_;             ///< The combined mask of accepted additional contexts levels of all listeners
+            OutputContextMask combinedAdditionalContextsMask_;                  ///< The combined mask of accepted additional contexts of all listeners
+
+            std::map<std::string, OutputContextMask> contextMasks_;             ///< Contains all main-contexts and their masks
+            std::map<std::string, OutputContextContainer> contextContainers_;   ///< Contains all contexts including sub-contexts and their containers
+            OutputContextSubID subcontextCounter_;                              ///< Counts the number of sub-contexts (and generates their IDs)
+    };
+}
+
+#endif /* _OutputManager_H__ */
Index: code/trunk/src/libraries/util/output/OutputStream.cc
===================================================================
--- code/trunk/src/libraries/util/output/OutputStream.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/OutputStream.cc	(revision 8858)
@@ -0,0 +1,86 @@
+/*
+ *   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
+    @brief Implementation of the non-generic functions of the OutputStream class.
+*/
+
+#include "OutputStream.h"
+
+#include "OutputManager.h"
+
+namespace orxonox
+{
+    /**
+        @brief Default constructor, initializes level and context with default values.
+    */
+    OutputStream::OutputStream()
+    {
+        this->setOutputAttributes(level::debug_output, context::undefined());
+    }
+
+    /**
+        @brief Constructor, initializes level and context with the provided values.
+    */
+    OutputStream::OutputStream(OutputLevel level, const OutputContextContainer& context)
+    {
+        this->setOutputAttributes(level, context);
+    }
+
+    /**
+        @brief Destructor, sends remaining output to OutputManager (if any).
+    */
+    OutputStream::~OutputStream()
+    {
+        if (this->str() != "")
+            *this << " [missing endl]" << std::endl;
+    }
+
+    /**
+        @brief Sends the buffered message to OutputManager together with the stored level and context.
+        Additionally empties the buffer.
+    */
+    void OutputStream::sendMessage()
+    {
+        OutputManager::getInstanceAndCreateListeners().pushMessage(this->level_, *this->context_, this->str());
+        this->str("");
+    }
+
+    /**
+        @brief Defines level and context of the following output.
+        Also sets the bAcceptsOutput_ flag according to the masks defined in OutputManager.
+    */
+    void OutputStream::setOutputAttributes(OutputLevel level, const OutputContextContainer& context)
+    {
+        this->level_ = level;
+        this->context_ = &context;
+
+        this->bAcceptsOutput_ = OutputManager::getInstanceAndCreateListeners().acceptsOutput(level, context);
+    }
+}
Index: code/trunk/src/libraries/util/output/OutputStream.h
===================================================================
--- code/trunk/src/libraries/util/output/OutputStream.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/OutputStream.h	(revision 8858)
@@ -0,0 +1,122 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the OutputStream class which is used to send output to orxonox::OutputManager.
+*/
+
+#ifndef _OutputStream_H__
+#define _OutputStream_H__
+
+#include "util/UtilPrereqs.h"
+
+#include <sstream>
+
+#include "OutputDefinitions.h"
+
+namespace orxonox
+{
+    /**
+        @brief This class is used to buffer output and send it to OutputManager whenever std::endl is passed to it.
+
+        OutputStream inherits from std::ostringstream and acts like std::cout.
+        This means you can use the << operator to write output to the stream.
+        This class is used by the orxout() function.
+
+        @attention
+        You must end an output message with std::endl, otherwise the message
+        won't be flushed. '\\n' only adds a new line to the message.
+
+        The following code samples are all equivalent:
+        @code
+        OutputStream stream;
+        stream.setOutputAttributes(user_info, context::example());
+        stream << "Hello World" << endl;
+        @endcode
+
+        @code
+        OutputStream stream(user_info, context::example());
+        stream << "Hello World" << endl;
+        @endcode
+
+        @code
+        orxout(user_info, context::example) << "Hello World" << endl;
+        @endcode
+    */
+    class OutputStream : public std::ostringstream
+    {
+        typedef std::ostream& (*EndlType)(std::ostream&);
+
+        public:
+            _UtilExport OutputStream();
+            _UtilExport OutputStream(OutputLevel level, const OutputContextContainer& context);
+            _UtilExport ~OutputStream();
+
+            void _UtilExport setOutputAttributes(OutputLevel level, const OutputContextContainer& context);
+
+            /// @brief Generic << operator which adds output to the stream.
+            template <class T>
+            inline OutputStream& operator<<(const T& val) { return this->output(val); }
+            /// @brief Sends a manipulator to the output stream.
+            inline OutputStream& operator<<(std::ios_base& (*manipulator)(std::ios_base&)) { return this->output(manipulator); }
+            /// @brief Sends a manipulator to the output stream.
+            inline OutputStream& operator<<(std::ios&      (*manipulator)(std::ios&))      { return this->output(manipulator); }
+            /// @brief Sends a manipulator to the output stream and flushes the message if the manipulator is std::endl.
+            inline OutputStream& operator<<(std::ostream&  (*manipulator)(std::ostream&))
+            {
+                if (this->bAcceptsOutput_)
+                {
+                    if (manipulator == static_cast<EndlType>(std::endl))
+                        this->sendMessage(); // send the message to OutputManager
+                    else
+                        return this->output(manipulator); // apply the manipulator
+                }
+                return *this;
+            }
+
+        private:
+            /// @brief Generic function to add values to the output stream, using the inherited << operator from std::ostringstream.
+            template <class T>
+            inline OutputStream& output(const T& val)
+            {
+                if (this->bAcceptsOutput_)
+                    static_cast<std::ostringstream&>(*this) << val;
+                return *this;
+            }
+
+            void _UtilExport sendMessage();
+
+            OutputLevel level_;                     ///< The output level of the current message
+            const OutputContextContainer* context_; ///< The output context of the current message
+            bool bAcceptsOutput_;                   ///< After defining level and context of the following message, this flag is set according to the masks defined in OutputManager. If it is false, the OutputStream will throw away every output sent using the << operator.
+    };
+}
+
+#endif /* _OutputStream_H__ */
Index: code/trunk/src/libraries/util/output/SubcontextOutputListener.cc
===================================================================
--- code/trunk/src/libraries/util/output/SubcontextOutputListener.cc	(revision 8858)
+++ code/trunk/src/libraries/util/output/SubcontextOutputListener.cc	(revision 8858)
@@ -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:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of the SubcontextOutputListener interface.
+*/
+
+#include "SubcontextOutputListener.h"
+
+namespace orxonox
+{
+    /**
+        @brief Constructor, initializes the context masks.
+    */
+    SubcontextOutputListener::SubcontextOutputListener(bool bRegister) : OutputListener(bRegister)
+    {
+        this->subcontextsCheckMask_ = context::none;
+        this->subcontextsNoCheckMask_ = context::none;
+    }
+
+    /**
+        @brief Destructor.
+    */
+    SubcontextOutputListener::~SubcontextOutputListener()
+    {
+    }
+
+    /**
+        @brief Overwritten implementation of the function defined by OutputListener.
+
+        Contexts defined with this function are accepted independent of the
+        sub-context. The "final" mask of additional contexts is defined by the
+        combination of this mask and the masks of all accepted sub-contexts.
+    */
+    void SubcontextOutputListener::setAdditionalContextsMask(OutputContextMask mask)
+    {
+        this->subcontextsNoCheckMask_ = mask;
+
+        OutputListener::setAdditionalContextsMask(this->subcontextsCheckMask_ | this->subcontextsNoCheckMask_);
+    }
+
+    /**
+        @brief Defines the set of accepted sub-contexts.
+
+        The masks of sub-contexts in this set are added to the mask of
+        additional contexts, but output is only accepted if the exact
+        sub-context exists in this set.
+    */
+    void SubcontextOutputListener::setAdditionalSubcontexts(const std::set<const OutputContextContainer*>& subcontexts)
+    {
+        this->subcontextsCheckMask_ = context::none;
+        this->subcontexts_.clear();
+
+        // compose the mask of subcontexts and build the set of sub-context-IDs
+        for (std::set<const OutputContextContainer*>::const_iterator it = subcontexts.begin(); it != subcontexts.end(); ++it)
+        {
+            this->subcontextsCheckMask_ |= (*it)->mask;
+            this->subcontexts_.insert((*it)->sub_id);
+        }
+
+        OutputListener::setAdditionalContextsMask(this->subcontextsCheckMask_ | this->subcontextsNoCheckMask_);
+    }
+
+    /**
+        @brief Returns true if this listener accepts output of the given level and context, based on the levels and contexts masks, as well as the set of accepted sub-contexts.
+    */
+    bool SubcontextOutputListener::acceptsOutput(OutputLevel level, const OutputContextContainer& context) const
+    {
+        // check if the output level is accepted by the level mask (independent of the context)
+        if (this->getLevelMask() & level)
+            return true;
+
+        // check if the output level is accepted by the additional contexts level mask
+        if (this->getAdditionalContextsLevelMask() & level)
+        {
+            // check if the output context is accepted by the "no check" mask
+            if (this->subcontextsNoCheckMask_ & context.mask)
+                return true;
+
+            // check if the output context is accepted by the "check" mask
+            if (this->subcontextsCheckMask_ & context.mask)
+            {
+                // check if the output's subcontext is in the set of accepted sub-context
+                if (this->subcontexts_.find(context.sub_id) != this->subcontexts_.end())
+                    return true;
+            }
+        }
+
+        // otherwise we don't accept the output
+        return false;
+    }
+}
Index: code/trunk/src/libraries/util/output/SubcontextOutputListener.h
===================================================================
--- code/trunk/src/libraries/util/output/SubcontextOutputListener.h	(revision 8858)
+++ code/trunk/src/libraries/util/output/SubcontextOutputListener.h	(revision 8858)
@@ -0,0 +1,87 @@
+/*
+ *   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
+    @ingroup Output
+    @brief Declaration of the SubcontextOutputListener interface which adds the ability to filter sub-contexts to OutputListener.
+*/
+
+#ifndef _SubcontextOutputListener_H__
+#define _SubcontextOutputListener_H__
+
+#include "util/UtilPrereqs.h"
+
+#include <set>
+
+#include "OutputListener.h"
+
+namespace orxonox
+{
+    /**
+        @brief This class extends the basic OutputListener interface and adds the ability to filter sub-contexts.
+
+        Defining additional contexts with setAdditionalContextsMask() enables
+        all sub-contexts of these additional contexts. To accept only some
+        particular sub-contexts, setAdditionalSubcontexts() has to be used.
+        Note that this requires a set, since a mask is not possible with
+        sub-contexts.
+
+        The "final" context mask which will be seen by OutputManager is the
+        combination of all regular contexts plus the masks of all sub-contexts.
+
+        @remark
+        It would have been possible to implement filtering of sub-contexts
+        directly in OutputListener and even to make OutputManager aware of
+        sub-contexts. This would reduce the amount of unnecessarily generated
+        output, but also increase the complexity of the checks whether some
+        output is needed.
+        On the other hand, filtering of sub-contexts makes the whole concept
+        more complicated, as it adds another mask and a set. So to keep it
+        clean and simple I figured it's best to put sub-context filtering into
+        a seaparate class.
+    */
+    class _UtilExport SubcontextOutputListener : public OutputListener
+    {
+        public:
+            SubcontextOutputListener(bool bRegister = true);
+            virtual ~SubcontextOutputListener();
+
+            void setAdditionalContextsMask(OutputContextMask mask);
+            void setAdditionalSubcontexts(const std::set<const OutputContextContainer*>& subcontexts);
+
+            virtual bool acceptsOutput(OutputLevel level, const OutputContextContainer& context) const;
+
+        private:
+            OutputContextMask subcontextsCheckMask_;    ///< All contexts defined by this mask need to be checked whether they are accepted by the set of sub-contexts
+            OutputContextMask subcontextsNoCheckMask_;  ///< All contexts defined by this mask don't need to be checked since we accept all sub-contexts
+            std::set<OutputContextSubID> subcontexts_;  ///< The set of accepted sub-contexts
+    };
+}
+
+#endif /* _SubcontextOutputListener_H__ */
Index: code/trunk/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/trunk/src/modules/designtools/ScreenshotManager.cc	(revision 8857)
+++ code/trunk/src/modules/designtools/ScreenshotManager.cc	(revision 8858)
@@ -153,8 +153,8 @@
             finalImage->save(PathConfig::getInstance().getLogPathString() + "screenshot_" + getTimestamp() + this->fileExtension_);
             delete finalImage;
-            COUT(3) << "Finished taking " << this->gridSize_*this->windowWidth_ << "x" << this->gridSize_*this->windowHeight_ << " pixel HD screenshot. Storing in log/." << endl;
+            orxout(user_info) << "Finished taking " << this->gridSize_*this->windowWidth_ << "x" << this->gridSize_*this->windowHeight_ << " pixel HD screenshot. Storing in log/." << endl;
         }
         else
-            COUT(1) << "There needs to be an active camera to make screenshots." << endl;
+            orxout(user_error) << "There needs to be an active camera to make screenshots." << endl;
 
         this->cleanup();
@@ -257,5 +257,5 @@
                 this->buffer_->blitToMemory(this->finalPicturePB_->getSubVolume(subBox));
                 
-                COUT(4) << "Created screenshot number " << nbScreenshots << " for multi grid HD screenshot." << endl;
+                orxout(internal_info) << "Created screenshot number " << nbScreenshots << " for multi grid HD screenshot." << endl;
                 
             }
Index: code/trunk/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/trunk/src/modules/designtools/SkyboxGenerator.cc	(revision 8857)
+++ code/trunk/src/modules/designtools/SkyboxGenerator.cc	(revision 8858)
@@ -149,5 +149,5 @@
             else
             {
-                COUT(1) << "You must be in a level to generate a skybox." << endl;
+                orxout(user_error) << "You must be in a level to generate a skybox." << endl;
                 this->bGenerateSkybox_ = false;
                 return;
@@ -175,5 +175,5 @@
                 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getInstance().getLogPathString(), "FileSystem", Resource::getDefaultResourceGroup());
                 
-                COUT(4) << "Setting up SkyboxGenerator..." << endl;
+                orxout(internal_status) << "Setting up SkyboxGenerator..." << endl;
                 
                 this->bSetup_ = false;
@@ -194,5 +194,5 @@
                     entity->pitch(Degree((float)rotate.second));
                 
-                COUT(4) << "Created face number " << this->faceCounter_ << "." << endl;
+                orxout(internal_info) << "Created face number " << this->faceCounter_ << "." << endl;
                 // Check whether we've generated all 6 faces.
                 if(++this->faceCounter_ >= 6)
@@ -225,5 +225,5 @@
                 CommandExecutor::execute("pause");
                 
-                COUT(3) << "Skybox with face size " << this->size_ << "x" << this->size_ << " pixels created. Storing in log/." << endl;
+                orxout(user_info) << "Skybox with face size " << this->size_ << "x" << this->size_ << " pixels created. Storing in log/." << endl;
             }
         }
Index: code/trunk/src/modules/docking/Dock.cc
===================================================================
--- code/trunk/src/modules/docking/Dock.cc	(revision 8857)
+++ code/trunk/src/modules/docking/Dock.cc	(revision 8858)
@@ -87,5 +87,5 @@
         {
             if(!pTrigger->isForPlayer()) {  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
-                COUT(4) << "Docking:execute PlayerTrigger was not triggered by a player.." << std::endl;
+                orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl;
                 return false;
             }
@@ -94,10 +94,10 @@
         else
         {
-            COUT(4) << "Docking::execute Not a player trigger, can't extract pawn from it.." << std::endl;
+            orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl;
             return false;
         }
         if(player == NULL)
         {
-            COUT(4) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
+            orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl;
             return false;
         }
@@ -168,5 +168,5 @@
         if(candidates_.find(player) == candidates_.end())
         {
-            COUT(2) << "Dock::dock Player is not a candidate!" << std::endl;
+            orxout(internal_warning, context::docking) << "Dock::dock Player is not a candidate!" << endl;
             return false;
         }
@@ -187,5 +187,5 @@
         if(docked_.find(player) == docked_.end())
         {
-            COUT(2) << "Dock::dockingAnimationFinished Player is not currently docked." << std::endl;
+            orxout(internal_warning, context::docking) << "Dock::dockingAnimationFinished Player is not currently docked." << endl;
             return false;
         }
@@ -200,5 +200,5 @@
         if(docked_.find(player) == docked_.end())
         {
-            COUT(2) << "Dock::undock Player is not docked to this Dock." << std::endl;
+            orxout(internal_warning, context::docking) << "Dock::undock Player is not docked to this Dock." << endl;
             return false;
         }
@@ -218,5 +218,5 @@
 
     bool Dock::undockingAnimationFinished(PlayerInfo* player) {
-        COUT(4) << "Dock::undockingAnimationFinished executed" << std::endl;
+        orxout(verbose, context::docking) << "Dock::undockingAnimationFinished executed" << endl;
         return true;
     }
Index: code/trunk/src/modules/docking/DockToShip.cc
===================================================================
--- code/trunk/src/modules/docking/DockToShip.cc	(revision 8857)
+++ code/trunk/src/modules/docking/DockToShip.cc	(revision 8858)
@@ -43,5 +43,5 @@
     {
         RegisterObject(DockToShip);
-        COUT(4) << "DockToShip instance created.." << endl;
+        orxout(verbose, context::docking) << "DockToShip instance created.." << endl;
     }
 
@@ -69,9 +69,9 @@
     bool DockToShip::docking(PlayerInfo* player)
     {
-        COUT(4) << "DockToShip::attach" << endl;
+        orxout(verbose, context::docking) << "DockToShip::attach" << endl;
 
         DockingTarget *target = DockingEffect::findTarget(this->target_);
         if (target == NULL) {
-            COUT(0) << "Can't retrieve target for '" << this->target_ << "'.." << std::endl;
+            orxout(internal_warning, context::docking) << "Can't retrieve target for '" << this->target_ << "'.." << endl;
             return false;
         }
@@ -79,5 +79,5 @@
         ControllableEntity *dockTo = (ControllableEntity*) target->getParent();
         if (dockTo == NULL) {
-            COUT(2) << "Parent is not a ControllableEntity.." << std::endl;
+            orxout(internal_warning, context::docking) << "Parent is not a ControllableEntity.." << endl;
             return false;
         }
@@ -92,5 +92,5 @@
     bool DockToShip::release(PlayerInfo* player)
     {
-        COUT(4) << "DockToShip::release" << endl;
+        orxout(verbose, context::docking) << "DockToShip::release" << endl;
 
         player->stopTemporaryControl();
Index: code/trunk/src/modules/docking/DockingController.cc
===================================================================
--- code/trunk/src/modules/docking/DockingController.cc	(revision 8857)
+++ code/trunk/src/modules/docking/DockingController.cc	(revision 8858)
@@ -97,5 +97,5 @@
         if (docking)
         {
-            COUT(4) << "DockingController::takeControl Taking over control." << std::endl;
+            orxout(verbose, context::docking) << "DockingController::takeControl Taking over control." << endl;
 
             this->entity_->setDestroyWhenPlayerLeft(false);
@@ -108,5 +108,5 @@
     void DockingController::positionReached()
     {
-        COUT(4) << "DockingController::positionReached() called." << std::endl;
+        orxout(verbose, context::docking) << "DockingController::positionReached() called." << endl;
 
         assert(this->player_);
Index: code/trunk/src/modules/docking/DockingTarget.cc
===================================================================
--- code/trunk/src/modules/docking/DockingTarget.cc	(revision 8857)
+++ code/trunk/src/modules/docking/DockingTarget.cc	(revision 8858)
@@ -53,5 +53,5 @@
         SUPER(DockingTarget, XMLPort, xmlelement, mode);
 
-        COUT(4) << "DockingTarget with name '" << this->getName() << "' created.." << std::endl;
+        orxout(verbose, context::docking) << "DockingTarget with name '" << this->getName() << "' created.." << endl;
     }
 
Index: code/trunk/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/trunk/src/modules/gametypes/RaceCheckPoint.cc	(revision 8857)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.cc	(revision 8858)
@@ -29,7 +29,8 @@
 #include "RaceCheckPoint.h"
 
+#include "util/Convert.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
-#include "util/Convert.h"
+#include "chat/ChatManager.h"
 
 #include "SpaceRace.h"
@@ -110,7 +111,7 @@
             {
                 const std::string& message =  "You have " + multi_cast<std::string>(this->bTimeLimit_)
-                            + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1) + "\n";
-                COUT(3) << message;
+                            + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1);
                 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
+                ChatManager::message(message);
             }
         }
Index: code/trunk/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.cc	(revision 8857)
+++ code/trunk/src/modules/gametypes/SpaceRace.cc	(revision 8858)
@@ -30,5 +30,5 @@
 
 #include "core/CoreIncludes.h"
-#include "network/Host.h"
+#include "chat/ChatManager.h"
 #include "util/Convert.h"
 #include "util/Math.h"
@@ -54,10 +54,10 @@
             this->clock_.capture();
             int s = this->clock_.getSeconds();
-            int ms = this->clock_.getMilliseconds()-1000*s;
+            int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
             const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
                         + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1)
                         + " before the time limit. You lose!";
-            COUT(3) << message;
             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+            ChatManager::message(message);
         }
         else
@@ -65,14 +65,16 @@
             this->clock_.capture();
             int s = this->clock_.getSeconds();
-            int ms = this->clock_.getMilliseconds()-1000*s;
+            int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
             const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
                         + "." + multi_cast<std::string>(ms) + " seconds.";
-            COUT(3) << message << std::endl;
             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+            ChatManager::message(message);
+/*
             float time = this->clock_.getSecondsPrecise();
             this->scores_.insert(time);
             std::set<float>::iterator it;
             for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
-            COUT(3) <<  multi_cast<std::string>(*it) << std::endl;
+                orxout(level::message) << multi_cast<std::string>(*it) << endl;
+*/
         }
     }
@@ -83,6 +85,6 @@
 
         std::string message("The match has started! Reach the check points as quickly as possible!");
-        COUT(3) << message << std::endl;
         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+        ChatManager::message(message);
     }
 
@@ -92,10 +94,10 @@
         this->clock_.capture();
         int s = this->clock_.getSeconds();
-        int ms = this->clock_.getMilliseconds()-1000*s;
+        int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
         const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
                         + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
-                        + " seconds.\n";
-        COUT(3) << message;
+                        + " seconds.";
         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+        ChatManager::message(message);
     }
 
Index: code/trunk/src/modules/notifications/NotificationDispatcher.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationDispatcher.cc	(revision 8857)
+++ code/trunk/src/modules/notifications/NotificationDispatcher.cc	(revision 8858)
@@ -137,5 +137,5 @@
             return false;
 
-        COUT(4) << "NotificationDispatcher (&" << this << ") triggered." << std::endl;
+        orxout(verbose, context::notifications) << "NotificationDispatcher (&" << this << ") triggered." << endl;
 
         PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
@@ -155,5 +155,5 @@
         if(player == NULL)
         {
-            COUT(4) << "The NotificationDispatcher was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
+            orxout(verbose, context::notifications) << "The NotificationDispatcher was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl;
             return false;
         }
Index: code/trunk/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.cc	(revision 8857)
+++ code/trunk/src/modules/notifications/NotificationManager.cc	(revision 8858)
@@ -57,5 +57,5 @@
         RegisterRootObject(NotificationManager);
 
-        COUT(3) << "NotificatioManager created." << std::endl;
+        orxout(internal_info, context::notifications) << "NotificatioManager created." << endl;
     }
 
@@ -71,5 +71,5 @@
         this->allNotificationsList_.clear();
 
-        COUT(3) << "NotificationManager destroyed." << std::endl;
+        orxout(internal_info, context::notifications) << "NotificationManager destroyed." << endl;
     }
 
@@ -132,5 +132,5 @@
 
         if(commandExecuted)
-            COUT(3) << "Notification command \"" << NotificationListener::command2Str(command) << "\" executed." << endl;
+            orxout(internal_info, context::notifications) << "Notification command \"" << NotificationListener::command2Str(command) << "\" executed." << endl;
 
         return commandExecuted;
@@ -198,5 +198,5 @@
         }
 
-        COUT(4) << "Notification (&" << notification << ") registered with the NotificationManager." << std::endl;
+        orxout(verbose, context::notifications) << "Notification (&" << notification << ") registered with the NotificationManager." << endl;
 
         return true;
@@ -219,5 +219,5 @@
         this->removeNotification(notification, *(this->notificationLists_.find(queue->getName())->second));
 
-        COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from NotificationQueue " << queue->getName() << "." << std::endl;
+        orxout(verbose, context::notifications) << "Notification (&" << notification << ") unregistered with the NotificationManager from NotificationQueue " << queue->getName() << "." << endl;
     }
 
@@ -351,5 +351,5 @@
         queue->update(); // Update the queue.
         
-        COUT(4) << "NotificationQueue '" << queue->getName() << "' registered with the NotificationManager." << std::endl;
+        orxout(verbose, context::notifications) << "NotificationQueue '" << queue->getName() << "' registered with the NotificationManager." << endl;
         return true;
     }
@@ -384,5 +384,5 @@
         this->notificationLists_.erase(queue->getName());
         
-        COUT(4) << "NotificationQueue '" << queue->getName() << "' unregistered with the NotificationManager." << std::endl;
+        orxout(verbose, context::notifications) << "NotificationQueue '" << queue->getName() << "' unregistered with the NotificationManager." << endl;
     }
 
Index: code/trunk/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.cc	(revision 8857)
+++ code/trunk/src/modules/notifications/NotificationQueue.cc	(revision 8858)
@@ -131,9 +131,9 @@
         {
             this->registered_ = false;
-            COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl;
+            orxout(internal_error, context::notifications) << "NotificationQueue '" << this->getName() << "' could not be registered." << endl;
             return;
         }
 
-        COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl;
+        orxout(internal_info, context::notifications) << "NotificationQueue '" << this->getName() << "' created." << endl;
     }
 
@@ -215,5 +215,5 @@
         delete notifications;
 
-        COUT(4) << "NotificationQueue '" << this->getName() << "' updated." << std::endl;
+        orxout(verbose, context::notifications) << "NotificationQueue '" << this->getName() << "' updated." << endl;
     }
 
@@ -232,5 +232,5 @@
         this->push(notification, time);
 
-        COUT(4) << "NotificationQueue '" << this->getName() << "' updated. A new Notification has been added." << std::endl;
+        orxout(verbose, context::notifications) << "NotificationQueue '" << this->getName() << "' updated. A new Notification has been added." << endl;
     }
 
@@ -265,6 +265,6 @@
         this->notificationPushed(notification);
 
-        COUT(5) << "Notification \"" << notification->getMessage() << "\" pushed to NotificationQueue '" << this->getName() << "'" << endl;
-        COUT(3) << "NotificationQueue \"" << this->getName() << "\": " << notification->getMessage() << endl;
+        orxout(verbose_more, context::notifications) << "Notification \"" << notification->getMessage() << "\" pushed to NotificationQueue '" << this->getName() << "'" << endl;
+        orxout(internal_info, context::notifications) << "NotificationQueue \"" << this->getName() << "\": " << notification->getMessage() << endl;
     }
 
@@ -284,5 +284,5 @@
             if(container == *it)
             {
-                COUT(5) << "Notification \"" << (*it)->notification->getMessage() << "\" popped from NotificationQueue '" << this->getName() << "'" << endl;
+                orxout(verbose_more, context::notifications) << "Notification \"" << (*it)->notification->getMessage() << "\" popped from NotificationQueue '" << this->getName() << "'" << endl;
                 this->ordering_.erase(it);
                 break;
@@ -311,5 +311,5 @@
         std::vector<NotificationContainer*>::difference_type index = it - this->notifications_.begin ();
 
-        COUT(5) << "Notification \"" << (*it)->notification->getMessage() << "\" removed from NotificationQueue '" << this->getName() << "'" << endl;
+        orxout(verbose_more, context::notifications) << "Notification \"" << (*it)->notification->getMessage() << "\" removed from NotificationQueue '" << this->getName() << "'" << endl;
 
         this->ordering_.erase(containerIterator);
@@ -333,5 +333,5 @@
     void NotificationQueue::clear(bool noGraphics)
     {
-        COUT(4) << "Clearing NotificationQueue " << this->getName() << "." << endl;
+        orxout(verbose, context::notifications) << "Clearing NotificationQueue " << this->getName() << "." << endl;
         this->ordering_.clear();
         // Delete all NotificationContainers in the list.
@@ -367,5 +367,5 @@
         if(size == 0)
         {
-            COUT(2) << "Trying to set maximal size of NotificationQueue '" << this->getName() << "' to 0. Ignoring..." << endl;
+            orxout(internal_warning, context::notifications) << "Trying to set maximal size of NotificationQueue '" << this->getName() << "' to 0. Ignoring..." << endl;
             return;
         }
@@ -398,5 +398,5 @@
         if(time != NotificationQueue::INF && time <= 0)
         {
-            COUT(2) << "Trying to set display time of NotificationQueue '" << this->getName() << "' to non-positive value. Ignoring..." << endl;
+            orxout(internal_warning, context::notifications) << "Trying to set display time of NotificationQueue '" << this->getName() << "' to non-positive value. Ignoring..." << endl;
         }
             
Index: code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc	(revision 8857)
+++ code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc	(revision 8858)
@@ -143,5 +143,5 @@
         if(size.x < 0.0 || size.x > 1.0 || size.z < 0.0 || size.z > 1.0)
         {
-            COUT(2) << "The display size of the NotificationQueueCEGUI " << this->getName() << " was trying to be set, but the relative size was not in [0,1]. Aborting..." << endl;
+            orxout(internal_warning, context::notifications) << "The display size of the NotificationQueueCEGUI " << this->getName() << " was trying to be set, but the relative size was not in [0,1]. Aborting..." << endl;
             return;
         }
@@ -183,5 +183,5 @@
         if(position.x < 0.0 || position.x > 1.0 || position.z < 0.0 || position.z > 1.0)
         {
-            COUT(2) << "The position the NotificationQueueCEGUI " << this->getName() << " was trying to be set, but the relative position was not in [0,1]. Aborting..." << endl;
+            orxout(internal_warning, context::notifications) << "The position the NotificationQueueCEGUI " << this->getName() << " was trying to be set, but the relative position was not in [0,1]. Aborting..." << endl;
             return;
         }
Index: code/trunk/src/modules/objects/ForceField.cc
===================================================================
--- code/trunk/src/modules/objects/ForceField.cc	(revision 8857)
+++ code/trunk/src/modules/objects/ForceField.cc	(revision 8858)
@@ -216,5 +216,5 @@
         else
         {
-            COUT(2) << "Wrong mode '" << mode << "' in ForceField. Setting to 'tube'." << std::endl;
+            orxout(internal_warning) << "Wrong mode '" << mode << "' in ForceField. Setting to 'tube'." << endl;
             this->mode_ = forceFieldMode::tube;
         }
Index: code/trunk/src/modules/objects/Planet.cc
===================================================================
--- code/trunk/src/modules/objects/Planet.cc	(revision 8857)
+++ code/trunk/src/modules/objects/Planet.cc	(revision 8858)
@@ -73,5 +73,5 @@
             {
                 float distance = this->getPosition().distance( activeCamera->getWorldPosition() );
-                //             COUT(2) << distance << std::endl;
+                //             orxout(internal_warning) << distance << endl;
                 float planetRadius = this->getScale();
 
Index: code/trunk/src/modules/objects/Script.cc
===================================================================
--- code/trunk/src/modules/objects/Script.cc	(revision 8857)
+++ code/trunk/src/modules/objects/Script.cc	(revision 8858)
@@ -137,5 +137,5 @@
             return false;
 
-        COUT(4) << "Script (&" << this << ") triggered." << std::endl;
+        orxout(verbose, context::misc::script) << "Script (&" << this << ") triggered." << endl;
 
         PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
@@ -155,5 +155,5 @@
         if(player == NULL)  //TODO: Will this ever happen? If not, change in NotificationDispatcher as well.
         {
-            COUT(4) << "The Script was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
+            orxout(internal_warning) << "The Script was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl;
             return false;
         }
@@ -272,5 +272,5 @@
         else
         {
-            COUT(2) << "Invalid mode '" << mode << "' in Script object. Setting to 'normal'." << std::endl;
+            orxout(internal_warning) << "Invalid mode '" << mode << "' in Script object. Setting to 'normal'." << endl;
             this->setMode(ScriptMode::normal);
             this->modeStr_ = Script::NORMAL;
@@ -323,5 +323,5 @@
         else
         {
-            COUT(2) << "Invalid times '" << times << "' in Script. Setting to infinity." << std::endl;
+            orxout(internal_warning) << "Invalid times '" << times << "' in Script. Setting to infinity." << endl;
             this->times_ = Script::INF;
             this->remainingExecutions_ = Script::INF;
Index: code/trunk/src/modules/objects/SpaceBoundaries.cc
===================================================================
--- code/trunk/src/modules/objects/SpaceBoundaries.cc	(revision 8857)
+++ code/trunk/src/modules/objects/SpaceBoundaries.cc	(revision 8858)
@@ -215,5 +215,5 @@
                 distance = this->computeDistance(currentPawn);
                 humanItem = this->isHumanPlayer(currentPawn);
-                COUT(5) << "Distance:" << distance << std::endl; // message for debugging
+//                orxout() << "Distance:" << distance << endl; // message for debugging
                 if(distance > this->warnDistance_ && distance < this->maxDistance_) // Display warning
                 {
@@ -231,5 +231,5 @@
                     if( humanItem )
                     {
-                        COUT(5) << "Health should be decreasing!" << std::endl;
+//                        orxout() << "Health should be decreasing!" << endl;
                         this->displayWarning("You are out of the area now!");
                     }
Index: code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc	(revision 8857)
+++ code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc	(revision 8858)
@@ -93,5 +93,5 @@
         if(!this->hasUniformScaling())
         {
-            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            orxout(internal_error) << "BoxCollisionShape: Non-uniform scaling is not yet supported." << endl;
             return;
         }
Index: code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc	(revision 8857)
+++ code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc	(revision 8858)
@@ -92,5 +92,5 @@
         if(!this->hasUniformScaling())
         {
-            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            orxout(internal_error) << "ConeCollisionShape: Non-uniform scaling is not yet supported." << endl;
             return;
         }
Index: code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc	(revision 8857)
+++ code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc	(revision 8858)
@@ -92,5 +92,5 @@
         if(!this->hasUniformScaling())
         {
-            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            orxout(internal_error) << "PlaneCollisionShape: Non-uniform scaling is not yet supported." << endl;
             return;
         }
Index: code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc	(revision 8857)
+++ code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc	(revision 8858)
@@ -89,5 +89,5 @@
         if(!this->hasUniformScaling())
         {
-            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            orxout(internal_error) << "SphereCollisionShape: Non-uniform scaling is not yet supported." << endl;
             return;
         }
Index: code/trunk/src/modules/objects/eventsystem/EventFilter.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventFilter.cc	(revision 8857)
+++ code/trunk/src/modules/objects/eventsystem/EventFilter.cc	(revision 8858)
@@ -63,5 +63,5 @@
         if (this->bActive_)
         {
-            COUT(2) << "Warning: Detected Event loop in EventFilter \"" << this->getName() << '"' << std::endl;
+            orxout(internal_warning, context::events) << "Detected Event loop in EventFilter \"" << this->getName() << '"' << endl;
             return;
         }
Index: code/trunk/src/modules/objects/eventsystem/EventListener.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventListener.cc	(revision 8857)
+++ code/trunk/src/modules/objects/eventsystem/EventListener.cc	(revision 8858)
@@ -59,9 +59,9 @@
         if (this->bActive_)
         {
-            COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << '"' << std::endl;
+            orxout(internal_warning, context::events) << "Detected Event loop in EventListener \"" << this->getName() << '"' << endl;
             return;
         }
 
-        COUT(4) << "EventListener, processing event: originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << ")" << ", activate: " << event.activate_ << ", name: " << event.name_ << std::endl;
+        orxout(verbose, context::events) << "EventListener, processing event: originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << ")" << ", activate: " << event.activate_ << ", name: " << event.name_ << endl;
 
         this->bActive_ = true;
Index: code/trunk/src/modules/objects/eventsystem/EventTarget.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventTarget.cc	(revision 8857)
+++ code/trunk/src/modules/objects/eventsystem/EventTarget.cc	(revision 8858)
@@ -60,5 +60,5 @@
         if (this->bActive_)
         {
-            COUT(2) << "Warning: Detected Event loop in EventTarget \"" << this->getName() << '"' << std::endl;
+            orxout(internal_warning, context::events) << "Detected Event loop in EventTarget \"" << this->getName() << '"' << endl;
             return;
         }
Index: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc	(revision 8857)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc	(revision 8858)
@@ -247,5 +247,5 @@
             this->setBeaconModeDirect(distanceMultiTriggerBeaconMode::exclude);
         else
-            COUT(1) << "Invalid beacon mode in DistanceMultiTrigger." << endl;
+            orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceMultiTrigger." << endl;
     }
 
Index: code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTrigger.cc	(revision 8857)
+++ code/trunk/src/modules/objects/triggers/DistanceTrigger.cc	(revision 8858)
@@ -108,5 +108,5 @@
         if (targetId == NULL)
         {
-            COUT(1) << "Error: \"" << targetStr << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << std::endl;
+            orxout(internal_error, context::triggers) << "\"" << targetStr << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << endl;
             return;
         }
@@ -209,5 +209,5 @@
                         this->setTriggeringPawn(pawn);
                     else
-                        CCOUT(2) << "Pawn was NULL." << endl;
+                        orxout(internal_warning, context::triggers) << "Pawn was NULL." << endl;
                 }
                 
@@ -270,5 +270,5 @@
             this->setBeaconModeDirect(distanceTriggerBeaconMode::exclude);
         else
-            COUT(1) << "Invalid beacon mode in DistanceTrigger." << endl;
+            orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceTrigger." << endl;
     }
 
Index: code/trunk/src/modules/objects/triggers/MultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTrigger.cc	(revision 8857)
+++ code/trunk/src/modules/objects/triggers/MultiTrigger.cc	(revision 8858)
@@ -72,5 +72,5 @@
     MultiTrigger::~MultiTrigger()
     {
-        COUT(4) << "Destroying MultiTrigger &" << this << ". " << this->stateQueue_.size() << " states still in queue. Deleting." << std::endl;
+        orxout(verbose, context::triggers) << "Destroying MultiTrigger &" << this << ". " << this->stateQueue_.size() << " states still in queue. Deleting." << endl;
         while(this->stateQueue_.size() > 0)
         {
@@ -94,5 +94,5 @@
         XMLPortParamLoadOnly(MultiTrigger, "target", addTarget, xmlelement, mode).defaultValues("Pawn"); //TODO: Remove load only
 
-        COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") created." << std::endl;
+        orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") created." << endl;
     }
 
@@ -132,5 +132,5 @@
                 if(state == NULL)
                 {
-                    COUT(1) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was NULL. State ignored." << std::endl;
+                    orxout(internal_error, context::triggers) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was NULL. State ignored." << endl;
                     queue->pop();
                     continue;
@@ -241,7 +241,7 @@
                             // Print some debug output if the state has changed.
                             if(state->originator != NULL)
-                                COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: " << state->originator->getIdentifier()->getName() << " (&" << state->originator << "), active: " << bActive << ", triggered: " << state->bTriggered << "." << std::endl;
+                                orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: " << state->originator->getIdentifier()->getName() << " (&" << state->originator << "), active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
                             else
-                                COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: NULL, active: " << bActive << ", triggered: " << state->bTriggered << "." << std::endl;
+                                orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: NULL, active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
 
                             // If the MultiTrigger has a parent trigger, that is itself a MultiTrigger, it needs to call a method to notify him, that its activity has changed.
@@ -254,5 +254,5 @@
                         {
                             this->BaseObject::setActive(false);
-                            COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") ran out of activations. Setting it to inactive." << std::endl;
+                            orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") ran out of activations. Setting it to inactive." << endl;
                         }
                     }
@@ -301,5 +301,5 @@
         if (target == NULL)
         {
-            COUT(1) << "Error: '" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl;
+            orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl;
             return;
         }
@@ -329,5 +329,5 @@
         if (target == NULL)
         {
-            COUT(1) << "Error: '" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl;
+            orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl;
             return;
         }
@@ -447,5 +447,5 @@
         {
             this->fireEvent(status);
-            COUT(4) << "MultiTrigger '" <<  this->getName() << "' (&" << this << "): Fired event. status: " << status << "." << std::endl;
+            orxout(verbose, context::triggers) << "MultiTrigger '" <<  this->getName() << "' (&" << this << "): Fired event. status: " << status << "." << endl;
             return;
         }
@@ -453,5 +453,5 @@
         MultiTriggerContainer* container = new MultiTriggerContainer(this, this, originator);
         this->fireEvent(status, container);
-        COUT(4) << "MultiTrigger '" <<  this->getName() << "' (&" << this << "): Fired event. originator: " << originator->getIdentifier()->getName() << " (&" << originator << "), status: " << status << "." << std::endl;
+        orxout(verbose, context::triggers) << "MultiTrigger '" <<  this->getName() << "' (&" << this << "): Fired event. originator: " << originator->getIdentifier()->getName() << " (&" << originator << "), status: " << status << "." << endl;
         delete container;
     }
Index: code/trunk/src/modules/objects/triggers/TriggerBase.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/TriggerBase.cc	(revision 8857)
+++ code/trunk/src/modules/objects/triggers/TriggerBase.cc	(revision 8858)
@@ -128,5 +128,5 @@
             this->setMode(TriggerMode::EventTriggerXOR);
         else
-            COUT(2) << "Invalid mode '" << modeName << "' in TriggerBase " << this->getName() << " &(" << this << "). Leaving mode at '" << this->getModeString() << "'." << std::endl;
+            orxout(internal_warning, context::triggers) << "Invalid mode '" << modeName << "' in TriggerBase " << this->getName() << " &(" << this << "). Leaving mode at '" << this->getModeString() << "'." << endl;
     }
 
Index: code/trunk/src/modules/overlays/GUIOverlay.cc
===================================================================
--- code/trunk/src/modules/overlays/GUIOverlay.cc	(revision 8857)
+++ code/trunk/src/modules/overlays/GUIOverlay.cc	(revision 8858)
@@ -76,10 +76,10 @@
             GUIManager::getInstance().showGUIExtra(this->guiName_, str);
 
-            COUT(4) << "Showing GUI " << this->guiName_ << std::endl;
+            orxout(verbose, context::misc::gui) << "Showing GUI " << this->guiName_ << endl;
         }
         else
         {
             GUIManager::hideGUI(this->guiName_);
-            COUT(4) << "Hiding GUI " << this->guiName_ << std::endl;
+            orxout(verbose, context::misc::gui) << "Hiding GUI " << this->guiName_ << endl;
         }
     }
Index: code/trunk/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/ChatOverlay.cc	(revision 8857)
+++ code/trunk/src/modules/overlays/hud/ChatOverlay.cc	(revision 8858)
@@ -67,25 +67,7 @@
     }
 
-    void ChatOverlay::incomingChat(const std::string& message, unsigned int senderID)
+    void ChatOverlay::incomingChat(const std::string& message, const std::string& /*name*/)
     {
-        std::string text;
-
-        if (senderID != NETWORK_PEER_ID_UNKNOWN)
-        {
-            std::string name = "unknown";
-
-            PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
-            if (player)
-                name = player->getName();
-
-            text = name + ": " + message;
-        }
-        else
-        {
-            text = message;
-        }
-
-        this->messages_.push_back(multi_cast<Ogre::DisplayString>(text));
-        COUT(0) << "Chat: " << text << std::endl;
+        this->messages_.push_back(multi_cast<Ogre::DisplayString>(message));
 
         Timer* timer = new Timer();
@@ -110,5 +92,5 @@
         this->text_->setCaption("");
 
-        for (std::list<Ogre::DisplayString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it)
+        for (std::list<Ogre::DisplayString>::iterator it = this->messages_.begin(); it != this->messages_.end(); ++it)
         {
             this->text_->setCaption(this->text_->getCaption() + "\n" + (*it));
Index: code/trunk/src/modules/overlays/hud/ChatOverlay.h
===================================================================
--- code/trunk/src/modules/overlays/hud/ChatOverlay.h	(revision 8857)
+++ code/trunk/src/modules/overlays/hud/ChatOverlay.h	(revision 8858)
@@ -35,5 +35,5 @@
 #include <OgreOverlayElement.h>
 
-#include "network/ChatListener.h"
+#include "chat/ChatListener.h"
 #include "overlays/OverlayText.h"
 
@@ -49,5 +49,5 @@
 
         protected:
-            virtual void incomingChat(const std::string& message, unsigned int senderID);
+            virtual void incomingChat(const std::string& message, const std::string& name);
 
             std::list<Ogre::DisplayString> messages_;
Index: code/trunk/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDNavigation.cc	(revision 8857)
+++ code/trunk/src/modules/overlays/hud/HUDNavigation.cc	(revision 8858)
@@ -105,5 +105,5 @@
     if ( fontPtr.isNull() )
     {
-        COUT ( 2 ) << "Warning: HUDNavigation: Font '" << font << "' not found" << std::endl;
+        orxout(internal_warning) << "HUDNavigation: Font '" << font << "' not found" << endl;
         return;
     }
@@ -125,5 +125,5 @@
     if ( size <= 0.0f )
     {
-        COUT ( 2 ) << "Warning: HUDNavigation: Negative font size not allowed" << std::endl;
+        orxout(internal_warning) << "HUDNavigation: Negative font size not allowed" << endl;
         return;
     }
Index: code/trunk/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDRadar.cc	(revision 8857)
+++ code/trunk/src/modules/overlays/hud/HUDRadar.cc	(revision 8858)
@@ -160,5 +160,5 @@
             if( !wePointer )
             {
-                CCOUT(0) << "Cannot display a non-WorldEntitiy on the radar" << std::endl;
+                orxout(internal_error) << "Cannot display a non-WorldEntitiy on the radar" << endl;
                 assert(0);
             }
Index: code/trunk/src/modules/pickup/Pickup.cc
===================================================================
--- code/trunk/src/modules/pickup/Pickup.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/Pickup.cc	(revision 8858)
@@ -169,5 +169,5 @@
         else
         {
-            COUT(1) << "Invalid activationType '" << type << "' in pickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in pickup." << endl;
         }
     }
@@ -191,5 +191,5 @@
         else
         {
-            COUT(1) << "Invalid durationType '" << type << "' in pickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in pickup." << endl;
         }
     }
Index: code/trunk/src/modules/pickup/PickupManager.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/PickupManager.cc	(revision 8858)
@@ -72,5 +72,5 @@
         this->defaultRepresentation_ = new PickupRepresentation();
 
-        COUT(3) << "PickupManager created." << std::endl;
+        orxout(internal_info, context::pickups) << "PickupManager created." << endl;
     }
 
@@ -101,5 +101,5 @@
         this->indexes_.clear();
 
-        COUT(3) << "PickupManager destroyed." << std::endl;
+        orxout(internal_info, context::pickups) << "PickupManager destroyed." << endl;
     }
 
@@ -126,5 +126,5 @@
         this->representations_[identifier] = representation;
 
-        COUT(4) << "PickupRepresentation &" << representation << " registered with the PickupManager." << std::endl;
+        orxout(verbose, context::pickups) << "PickupRepresentation &" << representation << " registered with the PickupManager." << endl;
         return true;
     }
@@ -151,5 +151,5 @@
         this->representations_.erase(it);
 
-        COUT(4) << "PickupRepresentation &" << representation << " unregistered with the PickupManager." << std::endl;
+        orxout(verbose, context::pickups) << "PickupRepresentation &" << representation << " unregistered with the PickupManager." << endl;
         return true;
     }
@@ -208,5 +208,5 @@
         if(it == this->representations_.end()) // If there is no PickupRepresentation associated with the input PickupIdentifier.
         {
-            COUT(4) << "PickupManager::getRepresentation() returned default representation." << std::endl;
+            orxout(verbose, context::pickups) << "PickupManager::getRepresentation() returned default representation." << endl;
             return this->defaultRepresentation_;
         }
@@ -284,5 +284,5 @@
         if(manager.pickupInventoryContainers_.find(pickup) == manager.pickupInventoryContainers_.end())
         {
-            COUT(1) << "Error: Pickupable &(" << pickup << ") was not registered with PickupManager for the PickupInventory, when it changed used." << std::endl;
+            orxout(internal_error, context::pickups) << "Pickupable &(" << pickup << ") was not registered with PickupManager for the PickupInventory, when it changed used." << endl;
             return;
         }
Index: code/trunk/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/PickupRepresentation.cc	(revision 8858)
@@ -140,5 +140,5 @@
             this->spawnerRepresentation_->setVisible(false);
 
-        COUT(4) << "PickupRepresentation created: name: '" << this->name_ << "', description: '" << this->description_ << "', spawnerTemplate: '" << this->spawnerTemplate_ << "'." << std::endl;
+        orxout(verbose, context::pickups) << "PickupRepresentation created: name: '" << this->name_ << "', description: '" << this->description_ << "', spawnerTemplate: '" << this->spawnerTemplate_ << "'." << endl;
     }
 
@@ -155,8 +155,8 @@
         if(this->spawnerRepresentation_ == NULL)
         {
-            COUT(4) << "PickupRepresentation: No spawner representation found." << std::endl;
+            orxout(verbose, context::pickups) << "PickupRepresentation: No spawner representation found." << endl;
             if(this->spawnerTemplate_ == "")
             {
-                COUT(4) << "PickupRepresentation: Spawner template is empty." << std::endl;
+                orxout(verbose, context::pickups) << "PickupRepresentation: Spawner template is empty." << endl;
                 // If neither spawnerRepresentation nor spawnerTemplate was specified
                 return this->getDefaultSpawnerRepresentation(spawner);
Index: code/trunk/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupSpawner.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/PickupSpawner.cc	(revision 8858)
@@ -90,5 +90,5 @@
         if(this->pickup_ == NULL)
         {
-            COUT(2) << "A PickupSpawner was created without a valid Pickupable. This won't work." << std::endl;
+            orxout(internal_warning, context::pickups) << "A PickupSpawner was created without a valid Pickupable. This won't work." << endl;
             this->setActive(false);
         }
@@ -144,5 +144,5 @@
         if(this->pickup_ == NULL)
         {
-            COUT(2) << "A PickupSpawner was created without a valid Pickupable. This won't work." << std::endl;
+            orxout(internal_warning, context::pickups) << "A PickupSpawner was created without a valid Pickupable. This won't work." << endl;
             this->setActive(false);
         }
@@ -239,5 +239,5 @@
         else
         {
-            COUT(4) << "PickupSpawner (&" << this << ") empty, selfdestruct initialized." << std::endl;
+            orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") empty, selfdestruct initialized." << endl;
             this->setActive(false);
             this->destroy();
@@ -264,10 +264,10 @@
         if(this->pickup_ != NULL)
         {
-            COUT(1) << "In PickupSpawner (&" << this << "): setPickupable called, with this->pickup_ already set." << std::endl;
+            orxout(internal_error, context::pickups) << "In PickupSpawner (&" << this << "): setPickupable called, with this->pickup_ already set." << endl;
             return;
         }
         if(pickup == NULL)
         {
-            COUT(1) << "In PickupSpawner (&" << this << "): Argument of setPickupable is NULL." << std::endl;
+            orxout(internal_error, context::pickups) << "In PickupSpawner (&" << this << "): Argument of setPickupable is NULL." << endl;
             return;
         }
@@ -298,5 +298,5 @@
         if(this->isActive()) // Checks whether PickupSpawner is active.
         {
-            COUT(4) << "PickupSpawner (&" << this << ") triggered and active." << std::endl;
+            orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered and active." << endl;
 
             PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
@@ -306,5 +306,5 @@
             if(!carrier->isTarget(this->pickup_))
             {
-                COUT(4) << "PickupSpawner (&" << this << ") triggered but Pawn wasn't a target of the Pickupable." << std::endl;
+                orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered but Pawn wasn't a target of the Pickupable." << endl;
                 return;
             }
@@ -335,5 +335,5 @@
         if(this->spawnsRemaining_ == 0)
         {
-            COUT(1) << "Massive Error: PickupSpawner still alive until having spawned last item." << std::endl;
+            orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl;
             return NULL;
         }
@@ -349,5 +349,5 @@
     void PickupSpawner::respawnTimerCallback()
     {
-        COUT(4) << "PickupSpawner (&" << this << ") reactivated." << std::endl;
+        orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") reactivated." << endl;
 
         this->setActive(true);
Index: code/trunk/src/modules/pickup/items/DronePickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/DronePickup.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/items/DronePickup.cc	(revision 8858)
@@ -179,5 +179,5 @@
         if(pawn == NULL)
         {
-            COUT(1) << "Invalid PickupCarrier in DronePickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DronePickup." << endl;
         }
 
Index: code/trunk/src/modules/pickup/items/HealthPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/HealthPickup.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/items/HealthPickup.cc	(revision 8858)
@@ -169,5 +169,5 @@
                     break;
                 default:
-                    COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
+                    orxout(internal_error, context::pickups) << "Invalid healthType in HealthPickup." << endl;
             }
 
@@ -218,5 +218,5 @@
                         break;
                     default:
-                        COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
+                        orxout(internal_error, context::pickups) << "Invalid healthType in HealthPickup." << endl;
                 }
 
@@ -234,5 +234,5 @@
                 if(pawn == NULL)
                 {
-                    COUT(1) << "Something went horribly wrong in Health Pickup. PickupCarrier is no Pawn." << std::endl;
+                    orxout(internal_error, context::pickups) << "Something went horribly wrong in Health Pickup. PickupCarrier is no Pawn." << endl;
                     this->Pickupable::destroy();
                     return;
@@ -268,5 +268,5 @@
         if(pawn == NULL)
         {
-            COUT(1) << "Invalid PickupCarrier in HealthPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl;
         }
 
@@ -312,5 +312,5 @@
                 return HealthPickup::healthTypePermanent_s;
             default:
-                COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
+                orxout(internal_error, context::pickups) << "Invalid healthType in HealthPickup." << endl;
                 return BLANKSTRING;
         }
@@ -331,5 +331,5 @@
         else
         {
-            COUT(1) << "Invalid health in HealthPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid health in HealthPickup." << endl;
             this->health_ = 0.0;
         }
@@ -350,5 +350,5 @@
         else
         {
-            COUT(1) << "Invalid healthSpeed in HealthPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid healthSpeed in HealthPickup." << endl;
         }
     }
@@ -376,5 +376,5 @@
         else
         {
-            COUT(1) << "Invalid healthType in HealthPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid healthType in HealthPickup." << endl;
         }
     }
Index: code/trunk/src/modules/pickup/items/InvisiblePickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/InvisiblePickup.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/items/InvisiblePickup.cc	(revision 8858)
@@ -206,5 +206,5 @@
         if(pawn == NULL)
         {
-            COUT(1) << "Invalid PickupCarrier in InvisiblePickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in InvisiblePickup." << endl;
         }
         return pawn;
@@ -225,5 +225,5 @@
         else
         {
-            COUT(1) << "Invalid duration in InvisiblePickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid duration in InvisiblePickup." << endl;
             this->duration_ = 0.0f;
         }
Index: code/trunk/src/modules/pickup/items/MetaPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/MetaPickup.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/items/MetaPickup.cc	(revision 8858)
@@ -232,5 +232,5 @@
         }
         else
-            COUT(2) << "Invalid metaType '" << type << "' in MetaPickup." << std::endl;
+            orxout(internal_warning, context::pickups) << "Invalid metaType '" << type << "' in MetaPickup." << endl;
     }
 
Index: code/trunk/src/modules/pickup/items/ShieldPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/ShieldPickup.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/items/ShieldPickup.cc	(revision 8858)
@@ -181,5 +181,5 @@
         if(pawn == NULL)
         {
-            COUT(1) << "Invalid PickupCarrier in ShieldPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in ShieldPickup." << endl;
         }
         return pawn;
@@ -220,5 +220,5 @@
         else
         {
-            COUT(1) << "Invalid duration in ShieldPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid duration in ShieldPickup." << endl;
             this->duration_ = 0.0f;
         }
@@ -239,5 +239,5 @@
         else
         {
-            COUT(1) << "Invalid Shieldhealth in ShieldPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid Shieldhealth in ShieldPickup." << endl;
             this->shieldHealth_=0;
         }
@@ -258,5 +258,5 @@
         else
         {
-            COUT(1) << "Invalid Absorption in ShieldPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid Absorption in ShieldPickup." << endl;
             this->shieldAbsorption_=0;
         }
Index: code/trunk/src/modules/pickup/items/ShrinkPickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/ShrinkPickup.h	(revision 8857)
+++ code/trunk/src/modules/pickup/items/ShrinkPickup.h	(revision 8858)
@@ -93,5 +93,5 @@
             */
             inline void setShrinkFactor(float factor)
-                { if(factor <= 1.0f) { COUT(2) << "Invalid shrinking factor in ShrinkPickup. Ignoring.." << endl; return; } this->shrinkFactor_ = factor; }
+                { if(factor <= 1.0f) { orxout(internal_warning, context::pickups) << "Invalid shrinking factor in ShrinkPickup. Ignoring.." << endl; return; } this->shrinkFactor_ = factor; }
             /**
             @brief Get the duration for which the ship remains shrunken.
@@ -105,5 +105,5 @@
             */
             inline void setDuration(float duration)
-                { if(duration < 0.0f) { COUT(2) << "Invalid duration in ShrinkPickup. Ignoring.." << endl; return; } this->duration_ = duration; }
+                { if(duration < 0.0f) { orxout(internal_warning, context::pickups) << "Invalid duration in ShrinkPickup. Ignoring.." << endl; return; } this->duration_ = duration; }
             /**
             @brief Get the shrink speed.
@@ -117,5 +117,5 @@
             */
             inline void setShrinkDuration(float speed)
-                { if(speed <= 0.0f) { COUT(2) << "Invalid shrink duration in ShrinkPickup. Ignoring.." << endl; return; } this->shrinkDuration_ = speed; }
+                { if(speed <= 0.0f) { orxout(internal_warning, context::pickups) << "Invalid shrink duration in ShrinkPickup. Ignoring.." << endl; return; } this->shrinkDuration_ = speed; }
 
         protected:
Index: code/trunk/src/modules/pickup/items/SpeedPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/SpeedPickup.cc	(revision 8857)
+++ code/trunk/src/modules/pickup/items/SpeedPickup.cc	(revision 8858)
@@ -180,5 +180,5 @@
         if(ship == NULL)
         {
-            COUT(1) << "Invalid PickupCarrier in SpeedPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid PickupCarrier in SpeedPickup." << endl;
         }
 
@@ -221,5 +221,5 @@
         else
         {
-            COUT(1) << "Invalid duration in SpeedPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid duration in SpeedPickup." << endl;
             this->duration_ = 0.0f;
         }
@@ -240,5 +240,5 @@
         else
         {
-            COUT(1) << "Invalid speedAdd in SpeedPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid speedAdd in SpeedPickup." << endl;
             this->speedAdd_ = 0.0f;
         }
@@ -259,5 +259,5 @@
         else
         {
-            COUT(1) << "Invalid speedMultiply in SpeedPickup." << std::endl;
+            orxout(internal_error, context::pickups) << "Invalid speedMultiply in SpeedPickup." << endl;
             this->speedMultiply_ = 1.0f;
         }
Index: code/trunk/src/modules/pong/Pong.cc
===================================================================
--- code/trunk/src/modules/pong/Pong.cc	(revision 8857)
+++ code/trunk/src/modules/pong/Pong.cc	(revision 8858)
@@ -162,5 +162,5 @@
         else // If no centerpoint was specified, an error is thrown and the level is exited.
         {
-            COUT(1) << "Error: No Centerpoint specified." << std::endl;
+            orxout(internal_error) << "Pong: No Centerpoint specified." << endl;
             GSLevel::startMainMenu();
             return;
Index: code/trunk/src/modules/questsystem/GlobalQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/GlobalQuest.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/GlobalQuest.cc	(revision 8858)
@@ -71,5 +71,5 @@
         XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode);
 
-        COUT(4) << "New GlobalQuest {" << this->getId() << "} created." << std::endl;
+        orxout(verbose, context::quests) << "New GlobalQuest {" << this->getId() << "} created." << endl;
     }
 
@@ -87,5 +87,5 @@
         if(!this->isFailable(player)) // Check whether the Quest can be failed.
         {
-            COUT(4) << "A non-completable quest was trying to be failed." << std::endl;
+            orxout(verbose, context::quests) << "A non-completable quest was trying to be failed." << endl;
             return false;
         }
@@ -114,5 +114,5 @@
         if(!this->isCompletable(player)) // Check whether the Quest can be completed.
         {
-            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
+            orxout(verbose, context::quests) << "A non-completable quest was trying to be completed." << endl;
             return false;
         }
@@ -227,5 +227,5 @@
         this->rewards_.push_back(effect); // Add the QuestEffect to the list.
 
-        COUT(4) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl;
+        orxout(verbose, context::quests) << "Reward effect was added to Quest {" << this->getId() << "}." << endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/LocalQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/LocalQuest.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/LocalQuest.cc	(revision 8858)
@@ -69,5 +69,5 @@
         SUPER(LocalQuest, XMLPort, xmlelement, mode);
 
-        COUT(4) << "New LocalQuest {" << this->getId() << "} created." << std::endl;
+        orxout(verbose, context::quests) << "New LocalQuest {" << this->getId() << "} created." << endl;
     }
 
@@ -85,5 +85,5 @@
         if(!this->isFailable(player)) // Checks whether the quest can be failed.
         {
-            COUT(4) << "A non-failable quest was trying to be failed." << std::endl;
+            orxout(verbose, context::quests) << "A non-failable quest was trying to be failed." << endl;
             return false;
         }
@@ -108,5 +108,5 @@
         if(!this->isCompletable(player)) // Checks whether the Quest can be completed.
         {
-            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
+            orxout(verbose, context::quests) << "A non-completable quest was trying to be completed." << endl;
             return false;
         }
Index: code/trunk/src/modules/questsystem/Quest.cc
===================================================================
--- code/trunk/src/modules/questsystem/Quest.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/Quest.cc	(revision 8858)
@@ -96,5 +96,5 @@
         this->parentQuest_ = quest;
 
-        COUT(4) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        orxout(verbose, context::quests) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << endl;
         return true;
     }
@@ -115,5 +115,5 @@
         this->subQuests_.push_back(quest); // Adds the Quest to the end of the list of sub-quests.
 
-        COUT(4) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        orxout(verbose, context::quests) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << endl;
         return true;
     }
@@ -135,5 +135,5 @@
         this->hints_.push_back(hint); // Adds the QuestHint to the end of the list of QuestHints.
 
-        COUT(4) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
+        orxout(verbose, context::quests) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << endl;
         return true;
     }
@@ -153,5 +153,5 @@
         this->failEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of fail QuestEffects.
 
-        COUT(4) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;
+        orxout(verbose, context::quests) << "A FailEffect was added to Quest {" << this->getId() << "}." << endl;
         return true;
     }
@@ -171,5 +171,5 @@
         this->completeEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of complete QuestEffects.
 
-        COUT(4) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;
+        orxout(verbose, context::quests) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << endl;
         return true;
     }
@@ -341,5 +341,5 @@
         this->setStatus(player, QuestStatus::Failed);
 
-        COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
+        orxout(verbose, context::quests) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." << endl;
 
         this->getDescription()->sendFailQuestNotification(player);
@@ -360,5 +360,5 @@
         this->setStatus(player, QuestStatus::Completed);
 
-        COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
+        orxout(verbose, context::quests) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." << endl;
 
         this->getDescription()->sendCompleteQuestNotification(player);
@@ -378,9 +378,9 @@
         if(!this->isStartable(player)) // Checks whether the quest can be started.
         {
-            COUT(4) << "A non-startable quest was trying to be started." << std::endl;
+            orxout(verbose, context::quests) << "A non-startable quest was trying to be started." << endl;
             return false;
         }
 
-        COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl;
+        orxout(verbose, context::quests) << "Quest {" << this->getId() << "} is started for player: " << player << " ." << endl;
 
         QuestListener::advertiseStatusChange(this->listeners_, "start"); // Tells the QuestListeners, that the status has changed to active.
Index: code/trunk/src/modules/questsystem/QuestDescription.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/QuestDescription.cc	(revision 8858)
@@ -79,5 +79,5 @@
         XMLPortParam(QuestDescription, "completeMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode);
 
-        COUT(4) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;
+        orxout(verbose, context::quests) << "New QuestDescription with title '" << this->getTitle() << "' created." << endl;
     }
 
@@ -109,5 +109,5 @@
             else
             {
-                COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
+                orxout(internal_warning, context::quests) << "Bad input in notificationHelper, this should not be happening!" << endl;
                 return false;
             }
@@ -115,5 +115,5 @@
         else
         {
-            COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl;
+            orxout(internal_warning, context::quests) << "Bad input in notificationHelper, this should not be happening!" << endl;
             return false;
         }
Index: code/trunk/src/modules/questsystem/QuestEffect.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffect.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/QuestEffect.cc	(revision 8858)
@@ -70,5 +70,5 @@
         bool temp = true;
 
-        COUT(4) << "Invoking QuestEffects on player: " << player << " ."  << std::endl;
+        orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ."  << endl;
 
         for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
Index: code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffectBeacon.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/QuestEffectBeacon.cc	(revision 8858)
@@ -79,5 +79,5 @@
         XMLPortEventSink(QuestEffectBeacon, BaseObject, "execute", execute, xmlelement, mode); //TODO: Change BaseObject to MultiTrigger as soon as MultiTrigger is the base of all triggers.
 
-        COUT(4) << "New QuestEffectBeacon created." << std::endl;
+        orxout(verbose, context::quests) << "New QuestEffectBeacon created." << endl;
     }
 
@@ -108,5 +108,5 @@
         if(!(this->isActive())) // If the QuestEffectBeacon is inactive it cannot be executed.
         {
-            COUT(4) << "The QuestEffectBeacon is inactive." << std::endl;
+            orxout(verbose, context::quests) << "The QuestEffectBeacon is inactive." << endl;
             return false;
         }
@@ -128,9 +128,9 @@
         if(player == NULL)
         {
-            COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
-            return false;
-        }
-
-        COUT(4) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
+            orxout(verbose, context::quests) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl;
+            return false;
+        }
+
+        orxout(verbose, context::quests) << "QuestEffectBeacon executed on player: " << player << " ." << endl;
 
         bool temp = QuestEffect::invokeEffects(player, this->effects_); // Invoke the QuestEffects on the PlayerInfo.
@@ -221,5 +221,5 @@
         this->effects_.push_back(effect);
 
-        COUT(4) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;
+        orxout(verbose, context::quests) << "A QuestEffect was added to a QuestEffectBeacon." << endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/QuestHint.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestHint.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/QuestHint.cc	(revision 8858)
@@ -74,5 +74,5 @@
         QuestManager::getInstance().registerHint(this); // Registers the QuestHint with the QuestManager.
 
-        COUT(4) << "New QuestHint {" << this->getId() << "} created." << std::endl;
+        orxout(verbose, context::quests) << "New QuestHint {" << this->getId() << "} created." << endl;
     }
 
@@ -120,10 +120,10 @@
             else
             {
-                COUT(4) << "An already active questHint was trying to get activated." << std::endl;
+                orxout(verbose, context::quests) << "An already active questHint was trying to get activated." << endl;
                 return false;
             }
         }
 
-        COUT(4) << "A hint of a non-active quest was trying to get activated." << std::endl;
+        orxout(verbose, context::quests) << "A hint of a non-active quest was trying to get activated." << endl;
         return false;
     }
Index: code/trunk/src/modules/questsystem/QuestItem.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestItem.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/QuestItem.cc	(revision 8858)
@@ -89,5 +89,5 @@
         if(id == "") // Checks whether the id is a valid id.
         {
-            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+            orxout(internal_warning, context::quests) << "Invalid id. QuestItem id {" << id << "} could not be set." << endl;
             return;
         }
Index: code/trunk/src/modules/questsystem/QuestListener.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestListener.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/QuestListener.cc	(revision 8858)
@@ -84,5 +84,5 @@
             this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners.
 
-        COUT(4) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;
+        orxout(verbose, context::quests) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << endl;
     }
 
@@ -146,5 +146,5 @@
         else
         {
-            COUT(2) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << std::endl;
+            orxout(internal_warning, context::quests) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << endl;
             this->mode_ = QuestListenerMode::All;
             return false;
Index: code/trunk/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/QuestManager.cc	(revision 8858)
@@ -61,5 +61,5 @@
         RegisterRootObject(QuestManager);
 
-        COUT(3) << "QuestManager created." << std::endl;
+        orxout(internal_info, context::quests) << "QuestManager created." << endl;
     }
 
@@ -70,5 +70,5 @@
     QuestManager::~QuestManager()
     {
-        COUT(3) << "QuestManager destroyed." << std::endl;
+        orxout(internal_info, context::quests) << "QuestManager destroyed." << endl;
     }
 
@@ -103,10 +103,10 @@
         {
             quest->setRegistered();
-            COUT(4) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl;
+            orxout(verbose, context::quests) << "Quest with questId {" << quest->getId() << "} successfully inserted." << endl;
             return true;
         }
         else
         {
-           COUT(2) << "Quest with the same id was already present." << std::endl;
+           orxout(internal_warning, context::quests) << "Quest with the same id was already present." << endl;
            return false;
         }
@@ -141,10 +141,10 @@
         {
             hint->setRegistered();
-            COUT(4) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl;
+            orxout(verbose, context::quests) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << endl;
             return true;
         }
         else
         {
-           COUT(2) << "QuestHint with the same id was already present." << std::endl;
+           orxout(internal_warning, context::quests) << "QuestHint with the same id was already present." << endl;
            return false;
         }
@@ -183,5 +183,5 @@
         {
            quest = NULL;
-           COUT(2) << "The quest with id {" << questId << "} is nowhere to be found." << std::endl;
+           orxout(internal_warning, context::quests) << "The quest with id {" << questId << "} is nowhere to be found." << endl;
         }
 
@@ -212,5 +212,5 @@
         {
            hint = NULL;
-           COUT(2) << "The hint with id {" << hintId << "} is nowhere to be found." << std::endl;
+           orxout(internal_warning, context::quests) << "The hint with id {" << hintId << "} is nowhere to be found." << endl;
         }
 
@@ -431,5 +431,5 @@
         if(player == NULL)
         {
-            COUT(1) << "Error: GUIOverlay with name '" << guiName << "' has no player." << std::endl;
+            orxout(internal_error, context::quests) << "GUIOverlay with name '" << guiName << "' has no player." << endl;
             return NULL;
         }
Index: code/trunk/src/modules/questsystem/effects/AddQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddQuest.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/effects/AddQuest.cc	(revision 8858)
@@ -70,5 +70,5 @@
         SUPER(AddQuest, XMLPort, xmlelement, mode);
 
-        COUT(4) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+        orxout(verbose, context::quests) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << endl;
     }
 
@@ -85,5 +85,5 @@
         assert(player);
 
-        COUT(5) << "AddQuest on player: " << player << " ." << std::endl;
+        orxout(verbose_more, context::quests) << "AddQuest on player: " << player << " ." << endl;
 
         try
@@ -95,9 +95,9 @@
         catch(const orxonox::Exception& ex)
         {
-            COUT(2) << ex.getFullDescription() << std::endl;
+            orxout(internal_warning, context::quests) << ex.getFullDescription() << endl;
             return false;
         }
 
-        COUT(4) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;
+        orxout(verbose, context::quests) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/effects/AddQuestHint.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddQuestHint.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/effects/AddQuestHint.cc	(revision 8858)
@@ -73,5 +73,5 @@
         XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
 
-        COUT(4) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
+        orxout(verbose, context::quests) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << endl;
     }
 
@@ -88,5 +88,5 @@
         if(id == "")
         {
-            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+            orxout(internal_warning, context::quests) << "Invalid id. QuestItem id {" << id << "} could not be set." << endl;
             return false;
         }
@@ -108,5 +108,5 @@
         assert(player);
 
-        COUT(5) << "AddQuestHint on player: " << player << " ." << std::endl;
+        orxout(verbose_more, context::quests) << "AddQuestHint on player: " << player << " ." << endl;
 
         try
@@ -118,9 +118,9 @@
         catch(const Exception& e)
         {
-           COUT(2) << e.getFullDescription() << std::endl;
+           orxout(internal_warning, context::quests) << e.getFullDescription() << endl;
            return false;
         }
 
-        COUT(4) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;
+        orxout(verbose, context::quests) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << endl;
         return true;
 
Index: code/trunk/src/modules/questsystem/effects/AddReward.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddReward.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/effects/AddReward.cc	(revision 8858)
@@ -70,5 +70,5 @@
         XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode);
 
-        COUT(4) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;
+        orxout(verbose, context::quests) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << endl;
     }
 
@@ -103,5 +103,5 @@
     bool AddReward::invoke(PlayerInfo* player)
     {
-        COUT(5) << "AddReward on player: " << player << " ." << std::endl;
+        orxout(verbose_more, context::quests) << "AddReward on player: " << player << " ." << endl;
 
         bool temp = true;
@@ -109,5 +109,5 @@
             temp = temp && (*reward)->reward(player);
 
-        COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl;
+        orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl;
 
         return temp;
Index: code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc	(revision 8858)
@@ -83,5 +83,5 @@
         if(id == "")
         {
-            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
+            orxout(internal_warning, context::quests) << "Invalid id. QuestItem id {" << id << "} could not be set." << endl;
             return false;
         }
Index: code/trunk/src/modules/questsystem/effects/CompleteQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/CompleteQuest.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/effects/CompleteQuest.cc	(revision 8858)
@@ -70,5 +70,5 @@
         SUPER(CompleteQuest, XMLPort, xmlelement, mode);
 
-        COUT(4) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+        orxout(verbose, context::quests) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << endl;
     }
 
@@ -85,5 +85,5 @@
         assert(player);
 
-        COUT(5) << "CompleteQuest on player: " << player << " ." << std::endl;
+        orxout(verbose_more, context::quests) << "CompleteQuest on player: " << player << " ." << endl;
 
         Quest* quest;
@@ -97,9 +97,9 @@
         catch(const Exception& e)
         {
-            COUT(2) << e.getFullDescription() << std::endl;
+            orxout(internal_warning, context::quests) << e.getFullDescription() << endl;
             return false;
         }
 
-        COUT(4) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;
+        orxout(verbose, context::quests) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << endl;
         return true;
     }
Index: code/trunk/src/modules/questsystem/effects/FailQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/FailQuest.cc	(revision 8857)
+++ code/trunk/src/modules/questsystem/effects/FailQuest.cc	(revision 8858)
@@ -70,5 +70,5 @@
         SUPER(FailQuest, XMLPort, xmlelement, mode);
 
-        COUT(4) << "New FailQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
+        orxout(verbose, context::quests) << "New FailQuest, with target Quest {" << this->getQuestId() << "}, created." << endl;
     }
 
@@ -85,5 +85,5 @@
         assert(player);
 
-        COUT(4) << "FailQuest on player: " << player << " ." << std::endl;
+        orxout(verbose, context::quests) << "FailQuest on player: " << player << " ." << endl;
 
         Quest* quest;
@@ -96,9 +96,9 @@
         catch(const Exception& e)
         {
-            COUT(2) << e.getFullDescription() << std::endl;
+            orxout(internal_warning, context::quests) << e.getFullDescription() << endl;
             return false;
         }
 
-        COUT(4) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
+        orxout(verbose, context::quests) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << endl;
         return true;
     }
Index: code/trunk/src/modules/tetris/Tetris.cc
===================================================================
--- code/trunk/src/modules/tetris/Tetris.cc	(revision 8857)
+++ code/trunk/src/modules/tetris/Tetris.cc	(revision 8858)
@@ -165,5 +165,5 @@
         else // If no centerpoint was specified, an error is thrown and the level is exited.
         {
-            COUT(1) << "Error: No Centerpoint specified." << std::endl;
+            orxout(internal_error) << "Tetris: No Centerpoint specified." << endl;
             GSLevel::startMainMenu();
             return;
Index: code/trunk/src/modules/weapons/RocketController.cc
===================================================================
--- code/trunk/src/modules/weapons/RocketController.cc	(revision 8857)
+++ code/trunk/src/modules/weapons/RocketController.cc	(revision 8858)
@@ -48,5 +48,5 @@
     {
         RegisterObject(RocketController);
-        COUT(5)<< "RocketController constructed\n";
+//        orxout() << "RocketController constructed" << endl;
 
         // Create a rocket for the controller.
@@ -73,5 +73,5 @@
     RocketController::~RocketController()
     {
-        COUT(5)<< "RocketController destroyed\n";
+//        orxout() << "RocketController destroyed" << endl;
     }
 
Index: code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.h	(revision 8857)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.h	(revision 8858)
@@ -64,5 +64,5 @@
             */
             inline void setDamage(float damage)
-                { if(damage >= 0.0f)  { this->damage_ = damage; return; } COUT(1) << "The input projectile damage must be non-negative. Ignoring..." << endl; }
+                { if(damage >= 0.0f)  { this->damage_ = damage; return; } orxout(internal_warning) << "The input projectile damage must be non-negative. Ignoring..." << endl; }
             /**
             @brief Get the normal damage done by this projectile.
@@ -79,5 +79,5 @@
             */
             inline void setHealthDamage(float healthdamage)
-                { if(healthdamage >= 0.0f)  { this->healthdamage_ = healthdamage; return; } COUT(1) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; }
+                { if(healthdamage >= 0.0f)  { this->healthdamage_ = healthdamage; return; } orxout(internal_warning) << "The input projectile health-damage must be non-negative. Ignoring..." << endl; }
             /**
             @brief Get the health-damage done by this projectile.
@@ -94,5 +94,5 @@
             */
             inline void setShieldDamage(float shielddamage)
-                { if(shielddamage >= 0.0f)  { this->shielddamage_ = shielddamage; return; } COUT(1) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; }
+                { if(shielddamage >= 0.0f)  { this->shielddamage_ = shielddamage; return; } orxout(internal_warning) << "The input projectile shield-damage must be non-negative. Ignoring..." << endl; }
             /**
             @brief Get the shield-damage done by this projectile.
Index: code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc	(revision 8857)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc	(revision 8858)
@@ -39,5 +39,4 @@
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
-#include "util/Debug.h"
 
 #include "controllers/Controller.h"
Index: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	(revision 8857)
+++ code/trunk/src/orxonox/CMakeLists.txt	(revision 8858)
@@ -32,6 +32,4 @@
   PlayerManager.cc
   Radar.cc
-  ChatHistory.cc
-  ChatInputHandler.cc
 #  Test.cc
 
@@ -42,4 +40,5 @@
 )
 
+ADD_SUBDIRECTORY(chat)
 ADD_SUBDIRECTORY(collisionshapes)
 ADD_SUBDIRECTORY(controllers)
@@ -59,5 +58,5 @@
   FIND_HEADER_FILES
   TOLUA_FILES
-    ChatInputHandler.h
+    chat/ChatInputHandler.h
     LevelInfo.h
     LevelManager.h
Index: code/trunk/src/orxonox/ChatHistory.cc
===================================================================
--- code/trunk/src/orxonox/ChatHistory.cc	(revision 8857)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- *   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:
- *      Sandro 'smerkli' Merkli
- *   Co-authors:
- *      ...
- *
- */
-
-#include "ChatHistory.h"
-#include "util/ScopedSingletonManager.h"
-
-#ifndef CHATTEST
-namespace orxonox
-{
-  /* singleton */
-  ManageScopedSingleton( ChatHistory, ScopeID::Root, false );
-#endif
-
-  /* constructor */
-#ifndef CHATTEST
-  //ChatHistory::ChatHistory( BaseObject* creator ) : BaseObject(creator)
-  ChatHistory::ChatHistory()
-#else
-  ChatHistory::ChatHistory()
-#endif
-  {
-    /* register the object */
-#ifndef CHATTEST
-    RegisterObject(ChatHistory);
-#endif
-
-    this->hist_log_enabled = true;
-
-    /* Read setting for logfiles */
-    if( hist_log_enabled ) /* NOTE Make this a check for the logfile setting */
-    { this->chat_hist_openlog();
-
-      /* push starting line */
-      this->chat_hist_logline( "--- Logfile opened ---" );
-    }
-
-    /* Read setting for maximum number of lines and set limit */
-    this->hist_maxlines = 200; /* NOTE to be changed, 200 is just for testing */
-  }
-
-  /* destructor */
-  ChatHistory::~ChatHistory()
-  {
-    chat_hist_closelog();
-
-    /* clear list */
-    this->hist_buffer.clear();
-  }
-
-  /* react to incoming chat */
-  void ChatHistory::incomingChat(const std::string& message,
-    unsigned int senderID)
-  {
-    /* --> a) look up the actual name of the sender */
-    std::string text;
-
-#ifndef CHATTEST
-    /* get sender ID and prepend it to the message */
-    if (senderID != NETWORK_PEER_ID_UNKNOWN)
-    {
-      /* if we can't find anything, use "unknown" as default */
-      std::string name = "unknown";
-
-      PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
-      if (player)
-        name = player->getName();
-
-      text = name + ": " + message;
-    }
-    else
-      text = message;
-#else
-    text = message;
-#endif
-
-    /* add the line to the history */
-    this->chat_hist_addline( text );
-
-    /* add the line to the log */
-    this->chat_hist_logline( text );
-  }
-
-  /* Synchronize logfile onto the hard drive */ /* MARK MARK */
-  int ChatHistory::syncLog()
-  {
-    //if( this->hist_logfile )
-      //this->hist_logfile.sync();
-    return 0;
-  }
-
-  /* add a line to this history */
-  int ChatHistory::chat_hist_addline( const std::string& toadd )
-  {
-    /* crop history at the end if it's too large */
-    while( this->hist_buffer.size() > this->hist_maxlines+1 )
-      this->hist_buffer.pop_front();
-
-    /* push to the front of the history */
-    this->hist_buffer.push_back( toadd );
-    return 0;
-  }
-
-  /* log a line to a logfile */
-  int ChatHistory::chat_hist_logline( const std::string& toadd )
-  {
-    /* output the line to the file if logging is enabled */
-    if( this->hist_log_enabled )
-      this->hist_logfile << toadd << std::endl;
-    return 0;
-  }
-
-  /* open logfile */
-  int ChatHistory::chat_hist_openlog()
-  {
-    /* TODO: find out the name of the file to log to via settings
-     *       and set the this->hist_logfile_path variable to it
-     */
-#ifndef CHATTEST
-    this->hist_logfile.open( (PathConfig::getInstance().getLogPathString() +
-      "chatlog.log").c_str(),
-      std::fstream::out | std::fstream::app );
-#else
-    this->hist_logfile.open( "/tmp/chatlog.log",
-      std::fstream::out | std::fstream::app );
-#endif
-
-    /* TODO check whether this works (not sure how you'd like it?) */
-    if( !this->hist_logfile )
-    { this->hist_log_enabled = false;
-#ifndef CHATTEST
-      COUT(2) << "Warning: Could not open logfile." << std::endl;
-#endif
-    }
-
-    /* if it worked */
-    return 0;
-  }
-
-  /* close logfile */
-  void ChatHistory::chat_hist_closelog()
-  {
-    /* see if we've actually got a logfile */
-    if( this->hist_logfile )
-    {
-      /* yes, we've got one, add a line that shows we're closing it */
-      this->chat_hist_logline( "--- Logfile closed ---" );
-
-      /* actually close down the file */
-      this->hist_logfile.close();
-    }
-  }
-
-  /* output history for debugging */
-  void ChatHistory::debug_printhist()
-  {
-    /* create deque iterator */
-    std::deque<std::string>::iterator it;
-
-    /* output all the strings */
-    for( it = this->hist_buffer.begin(); it != this->hist_buffer.end();
-      ++it )
-      std::cout << *it << std::endl;
-
-    /* output size */
-    std::cout << "Size: " << hist_buffer.size() << std::endl;
-  }
-
-#ifndef CHATTEST
-}
-#endif
Index: code/trunk/src/orxonox/ChatHistory.h
===================================================================
--- code/trunk/src/orxonox/ChatHistory.h	(revision 8857)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/*
- *   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:
- *      Sandro 'smerkli' Merkli
- *   Co-authors:
- *      ...
- *
- */
-
-#include <deque>
-#include <string>
-#include <fstream>
-#include <iostream>
-#include <cassert>
-
-/* define this if you're unit testing */
-//#define CHATTEST
-
-#ifndef CHATTEST
-#include <OrxonoxPrereqs.h>
-#include <PlayerManager.h>
-#include <infos/PlayerInfo.h>
-#include <core/BaseObject.h>
-#include <network/ChatListener.h>
-#include <core/PathConfig.h>
-#include <util/Singleton.h>
-#endif
-
-#ifndef _ChatHistory_H__
-#define _ChatHistory_H__
-
-
-/* Class to implement chat history */
-#ifndef CHATTEST
-namespace orxonox
-{
-#endif
-
-  /* constructor */
-#ifndef CHATTEST
-  class _OrxonoxExport ChatHistory : public ChatListener,
-    public Singleton<ChatHistory>
-
-#else
-  class ChatHistory
-#endif
-  {
-    public:
-      /* constructors, destructors */
-#ifndef CHATTEST
-      ChatHistory();
-      friend class Singleton<ChatHistory>;
-#else
-      ChatHistory();
-#endif
-      virtual ~ChatHistory();
-
-
-    //protected:
-      /** what to do with incoming chat
-       *
-       * \param message The incoming message
-       * \param senderID Identification number of the sender
-       */
-      virtual void incomingChat(const std::string& message,
-        unsigned int senderID);
-
-      /** Synchronize logfile onto the hard drive
-       *
-       * \return 0 for success, other for error
-       */
-      int syncLog();
-
-      /** debug-print: output the whole history to stdout */
-      void debug_printhist();
-
-    private:
-      /* FIELDS */
-      /** Vector to store the history in */
-      std::deque<std::string> hist_buffer;
-
-      /** Maximum number of lines stored in this history */
-      unsigned int hist_maxlines;
-
-      /** is logging enabled? */
-      bool hist_log_enabled;
-
-      /** path of logfile on the file system */
-      std::string hist_logfile_path;
-
-      /** Output file stream for logfile */
-      std::ofstream hist_logfile;
-
-#ifndef CHATTEST
-      static ChatHistory* singletonPtr_s;
-#endif
-
-
-
-      /* METHODS */
-      /** Append line to chat history
-       *
-       * \param toadd The line to add to the history
-       * \return 0 for success, other for error TODO: Throw exception
-       */
-      int chat_hist_addline( const std::string& toadd );
-
-      /** Append line to logfile
-       *
-       * \param toadd The line to add to the logfile
-       * \return 0 for success, other for error TODO: Throw exception
-       */
-      int chat_hist_logline( const std::string& toadd );
-
-      /** open logfile to log to
-       *
-       * \return 0 for success,s other for error
-       */
-      int chat_hist_openlog();
-
-
-      /** close logfile */
-      void chat_hist_closelog();
-  };
-
-#ifndef CHATTEST
-}
-#endif
-
-#endif /* _ChatHistory_H__ */
Index: code/trunk/src/orxonox/ChatInputHandler.cc
===================================================================
--- code/trunk/src/orxonox/ChatInputHandler.cc	(revision 8857)
+++ 	(revision )
@@ -1,356 +1,0 @@
-/*
- *   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:
- *      Sandro 'smerkli' Merkli
- *   Co-authors:
- *      ...
- *
- */
-
-#include "ChatInputHandler.h"
-
-#include <cassert>
-#include <string>
-#include <CEGUIWindow.h>
-#include <CEGUIWindowManager.h>
-#include <elements/CEGUIListbox.h>
-#include <elements/CEGUIListboxItem.h>
-#include <elements/CEGUIListboxTextItem.h>
-
-#include "util/ScopedSingletonManager.h"
-#include "core/CoreIncludes.h"
-#include "core/GUIManager.h"
-#include "core/command/ConsoleCommand.h"
-#include "core/input/InputBuffer.h"
-#include "core/input/InputManager.h"
-#include "core/input/InputState.h"
-#include "network/Host.h"
-
-#include "PlayerManager.h"
-#include "infos/PlayerInfo.h"
-
-namespace orxonox
-{
-  /* singleton */
-  ManageScopedSingleton( ChatInputHandler, ScopeID::Graphics, false );
-
-  /* add commands to console */
-  SetConsoleCommand( "startchat", &ChatInputHandler::activate_static );
-  SetConsoleCommand( "startchat_small", &ChatInputHandler::activate_small_static );
-
-  /* constructor */
-  ChatInputHandler::ChatInputHandler()
-  {
-    /* register the object  */
-    RegisterObject(ChatInputHandler);
-
-    /* create necessary objects */
-    this->inpbuf = new InputBuffer();
-    this->disp_offset = 0;
-    assert( this->inpbuf != NULL );
-
-    /* generate chatbox ui and chatbox-inputonly ui */
-    GUIManager::getInstance().loadGUI( "ChatBox" );
-    GUIManager::getInstance().loadGUI( "ChatBox-inputonly" );
-
-    /* setup colors */
-    setupColors();
-
-    /* configure the input buffer */
-    configureInputBuffer();
-
-    this->inputState = InputManager::getInstance().createInputState( "chatinput", false, false, InputStatePriority::Dynamic );
-    this->inputState->setKeyHandler(this->inpbuf);
-  }
-
-  ChatInputHandler::~ChatInputHandler()
-  {
-    /* Clean up */
-    InputManager::getInstance().destroyState("chatinput");
-    delete this->inpbuf;
-  }
-
-  /* configure input buffer, sub for the constructor */
-  void ChatInputHandler::configureInputBuffer()
-  {
-    /* INSTALL CALLBACKS */
-    /* input has changed */
-    this->inpbuf->registerListener(this, &ChatInputHandler::inputChanged, true);
-
-    /* add a line */
-    this->inpbuf->registerListener(this, &ChatInputHandler::addline,         '\r',   false);
-    this->inpbuf->registerListener(this, &ChatInputHandler::addline,         '\n',   false);
-
-    /* backspace */
-    this->inpbuf->registerListener(this, &ChatInputHandler::backspace,       '\b',   true);
-    //this->inpbuf->registerListener(this, &ChatInputHandler::backspace,       '\177', true);
-
-    /* exit the chatinputhandler thingy (tbd) */
-    this->inpbuf->registerListener(this, &ChatInputHandler::exit,            '\033', true); // escape
-
-    /* delete character */
-    this->inpbuf->registerListener(this, &ChatInputHandler::deleteChar,      KeyCode::Delete);
-
-    /* cursor movement */
-    this->inpbuf->registerListener(this, &ChatInputHandler::cursorRight,     KeyCode::Right);
-    this->inpbuf->registerListener(this, &ChatInputHandler::cursorLeft,      KeyCode::Left);
-    this->inpbuf->registerListener(this, &ChatInputHandler::cursorEnd,       KeyCode::End);
-    this->inpbuf->registerListener(this, &ChatInputHandler::cursorHome,      KeyCode::Home);
-
-    /* GET WINDOW POINTERS */
-    input = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/input" );
-    inputonly = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox-inputonly/input" );
-
-    /* get pointer to the history window */
-    CEGUI::Window *history = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/history" );
-
-    /* cast it to a listbox */
-    lb_history = dynamic_cast<CEGUI::Listbox*>(history);
-
-    /* assert wee */
-    assert( lb_history );
-  }
-
-  /* setup the colors, sub for the constructor */
-  void ChatInputHandler::setupColors()
-  {
-    /* auto variables */
-    float red = 1.0, green = 0.5, blue = 0.5;
-    int i = 0;
-
-    // three loops: red tones, blue tones and green tones
-    // reds
-    for( i = 0; i < NumberOfColors/3; ++i )
-    { this->text_colors[ i ] = CEGUI::colour( red, green, blue );
-      green += 0.2f, blue += 0.2f;
-    }
-
-    // greens
-    red = 0.5, green = 1, blue = 0.5;
-    for( ; i < NumberOfColors*2/3; ++i )
-    { this->text_colors[ i ] = CEGUI::colour( red, green, blue );
-      red += 0.2f, blue += 0.2f;
-    }
-
-    // blues
-    red = 0.5, green = 0.5, blue = 1;
-    for( ; i < NumberOfColors; ++i )
-    { this->text_colors[ i ] = CEGUI::colour( red, green, blue );
-      red += 0.2f, green += 0.2f;
-    }
-  }
-
-
-  /* activate, deactivate */
-  void ChatInputHandler::activate_static()
-  { ChatInputHandler::getInstance().activate( true ); }
-
-  void ChatInputHandler::activate_small_static()
-  { ChatInputHandler::getInstance().activate( false ); }
-
-  void ChatInputHandler::activate( bool full )
-  {
-    /* start listening */
-    InputManager::getInstance().enterState("chatinput");
-
-    /* MARK add spawning of chat widget stuff here.*/
-    if( full )
-      GUIManager::getInstance().showGUI( "ChatBox" );
-    else
-      GUIManager::getInstance().showGUI( "ChatBox-inputonly" );
-
-    this->fullchat = full;
-  }
-
-  void ChatInputHandler::deactivate()
-  {
-    /* stop listening */
-    InputManager::getInstance().leaveState("chatinput");
-
-    /* un-spawning of chat widget stuff */
-    GUIManager::getInstance().hideGUI( "ChatBox" );
-    GUIManager::getInstance().hideGUI( "ChatBox-inputonly" );
-  }
-
-
-  /* subs for incomingChat */
-  void ChatInputHandler::sub_setcolor( CEGUI::ListboxTextItem *tocolor,
-    std::string name )
-  {
-    /* sanity checks */
-    if( !tocolor )
-      COUT(2) << "Empty ListBoxTextItem given to "
-        "ChatInputhandler::sub_setcolor().\n";
-
-    /* "hash" the name */
-    int hash = 0;
-    for( int i = name.length(); i > 0; --i )
-      hash += name[i-1];
-    hash = hash % this->NumberOfColors;
-
-    /* set the color according to the hash */
-    tocolor->setTextColours( this->text_colors[ hash ] );
-  }
-
-  /* handle incoming chat */
-  void ChatInputHandler::incomingChat(const std::string& message,
-    unsigned int senderID)
-  {
-    /* look up the actual name of the sender */
-    std::string text, name = "unknown";
-
-    /* setup player name info */
-    if (senderID != NETWORK_PEER_ID_UNKNOWN)
-    {
-       PlayerInfo* player = PlayerManager::getInstance().getClient(senderID);
-       if (player)
-         name = player->getName();
-    }
-
-    /* assemble the text */
-    text = name + ": " + message;
-
-    /* create item */
-    CEGUI::ListboxTextItem *toadd = new CEGUI::ListboxTextItem( text );
-
-    /* setup colors */
-    sub_setcolor( toadd, name );
-
-    /* now add */
-    this->lb_history->addItem( dynamic_cast<CEGUI::ListboxItem*>(toadd) );
-    this->lb_history->ensureItemIsVisible(
-      dynamic_cast<CEGUI::ListboxItem*>(toadd) );
-
-    /* make sure the history handles it */
-    this->lb_history->handleUpdatedItemData();
-  }
-
-
-  /* sub for inputchanged */
-  void ChatInputHandler::sub_adjust_dispoffset( int maxlen,
-    int cursorpos,
-    int inplen )
-  {
-    /* already start offsetting 5 characters before end */
-    if( cursorpos+5 > maxlen )
-    {
-      /* always stay 5 characters ahead of end, looks better */
-      ((disp_offset = cursorpos-maxlen+5) >= 0) ? 1 : disp_offset = 0;
-
-      /* enforce visibility of cursor */
-      (disp_offset > cursorpos ) ? disp_offset = 0 : 1;
-    }
-
-    /* make sure we don't die at substr */
-    if( inplen <= disp_offset ) disp_offset = 0;
-  }
-
-  /* callbacks for InputBuffer */
-  void ChatInputHandler::inputChanged()
-  {
-    /* update the cursor and the window */
-    std::string raw = this->inpbuf->get();
-    int cursorpos = this->inpbuf->getCursorPosition();
-
-    /* get string before cursor */
-    std::string left = raw.substr( 0, cursorpos );
-
-    /* see if there's a string after the cursor */
-    std::string right = "";
-    if( raw.length() >= left.length()+1 )
-      right = raw.substr( cursorpos );
-
-    /* set the text */
-    std::string assembled = "$ " + left + "|" + right;
-
-    if( this->fullchat )
-    {
-      /* adjust curser position - magic number 5 for font width */
-      sub_adjust_dispoffset( (int)(this->input->getUnclippedInnerRect().getWidth()/6),
-        cursorpos, assembled.length() );
-      this->input->setProperty( "Text", assembled.substr( disp_offset ) );
-    }
-    else
-    {
-      /* adjust curser position - magic number 5 for font width */
-      sub_adjust_dispoffset( (int)(this->inputonly->getUnclippedInnerRect().getWidth()/6),
-        cursorpos, assembled.length() );
-      this->inputonly->setProperty( "Text", assembled.substr( disp_offset) );
-    }
-
-    /* reset display offset */
-    disp_offset = 0;
-  }
-
-  void ChatInputHandler::addline()
-  {
-    /* actually do send what was input */
-    /* a) get the string out of the inputbuffer */
-    std::string msgtosend = this->inpbuf->get();
-
-    if( msgtosend.length() == 0 )
-    { this->deactivate();
-      return;
-    }
-
-    /* b) clear the input buffer */
-    if (this->inpbuf->getSize() > 0)
-      this->inpbuf->clear();
-
-    /* c) send the chat via some call */
-    Host::Chat( msgtosend );
-
-    /* d) stop listening to input - only if this is not fullchat */
-    if( !this->fullchat )
-      this->deactivate();
-
-  }
-
-  void ChatInputHandler::backspace()
-  { this->inpbuf->removeBehindCursor(); }
-
-  void ChatInputHandler::deleteChar()
-  { this->inpbuf->removeAtCursor(); }
-
-  void ChatInputHandler::cursorRight()
-  { this->inpbuf->increaseCursor(); }
-
-  void ChatInputHandler::cursorLeft()
-  { this->inpbuf->decreaseCursor(); }
-
-  void ChatInputHandler::cursorEnd()
-  { this->inpbuf->setCursorToEnd(); }
-
-  void ChatInputHandler::cursorHome()
-  { this->inpbuf->setCursorToBegin(); }
-
-  void ChatInputHandler::exit()
-  {
-    /* b) clear the input buffer */
-    if (this->inpbuf->getSize() > 0)
-      this->inpbuf->clear();
-
-    /* d) stop listening to input  */
-    this->deactivate();
-  }
-
-}
Index: code/trunk/src/orxonox/ChatInputHandler.h
===================================================================
--- code/trunk/src/orxonox/ChatInputHandler.h	(revision 8857)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- *   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:
- *      Sandro 'smerkli' Merkli
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _ChatInputHandler_H__
-#define _ChatInputHandler_H__
-
-#include <OrxonoxPrereqs.h>
-
-#include <string>
-#include <CEGUIForwardRefs.h>
-#include <CEGUIcolour.h>
-
-#include "util/Singleton.h"
-#include "network/ChatListener.h"
-
-namespace orxonox // tolua_export
-{ // tolua_export
-  /* class to handle chat using an InputBuffer */
-  class _OrxonoxExport ChatInputHandler  // tolua_export
-    : public Singleton<ChatInputHandler>, public ChatListener
-  { // tolua_export
-    private:
-      /** Input buffer, to be used to catch input from the
-       * keyboard
-       */
-      InputBuffer *inpbuf;
-      int disp_offset, width;
-      bool fullchat;
-
-      /* colors for nickname coloring */
-      static const int NumberOfColors = 10;
-      CEGUI::colour text_colors[ NumberOfColors ];
-
-      /** input state */
-      InputState *inputState;
-
-      /** setup input buffer, the constructor calls this */
-      void configureInputBuffer();
-
-      /** adjust display offset depending on cursor position */
-      void sub_adjust_dispoffset( int maxlen, int cursorpos, int inplen );
-
-      /** singleton pointer */
-      static ChatInputHandler* singletonPtr_s;
-
-      /** cegui window handles */
-      CEGUI::Window *input, *inputonly;
-
-      /** cegui handle for the history window */
-      CEGUI::Listbox *lb_history;
-
-      /* methods to deal with colors */
-      void sub_setcolor( CEGUI::ListboxTextItem *tocolor,
-        std::string name );
-
-      void setupColors();
-
-      /* callbacks for input handler */
-      void inputChanged();
-      void addline();
-      void backspace();
-      void deleteChar();
-      void cursorRight();
-      void cursorLeft();
-      void cursorEnd();
-      void cursorHome();
-      void exit();
-
-    public:
-      /** constructor */
-      ChatInputHandler();
-      ~ChatInputHandler();
-      friend class Singleton<ChatInputHandler>;
-
-      static ChatInputHandler& getInstance(void) { return Singleton<ChatInputHandler>::getInstance(); }  // tolua_export
-
-      /** start listening */
-      static void activate_static();
-
-      /** stop listening */
-      static void activate_small_static();
-
-      /** \param message the message text
-       * \param senderID ID of the player who sent the message
-       *
-       * Deal with incoming chat (which means in our case: Add it to the
-       * history window of the full chat window)
-       */
-      void incomingChat( const std::string& message,
-        unsigned int senderID );
-
-      /** \param full true means show full chat window with history,
-            false means show only an input line
-       *
-       * Show the chat window and redirect the game's keyboard input
-       * into it.
-       */
-      void activate( bool full );
-
-      /** Deactivate the chat window, meaning: hide it. */
-      void deactivate();  // tolua_export
-
-  };  // tolua_export
-
-
-}  // tolua_export
-
-
-#endif /*_ChatInputHandler_H__*/
Index: code/trunk/src/orxonox/Level.cc
===================================================================
--- code/trunk/src/orxonox/Level.cc	(revision 8857)
+++ code/trunk/src/orxonox/Level.cc	(revision 8858)
@@ -88,5 +88,5 @@
     void Level::networkcallback_applyXMLFile()
     {
-        COUT(0) << "Loading level \"" << this->xmlfilename_ << "\"..." << std::endl;
+        orxout(user_status) << "Loading level \"" << this->xmlfilename_ << "\"..." << endl;
 
         ClassTreeMask mask;
@@ -115,5 +115,5 @@
         if (!identifier || !identifier->isA(Class(Gametype)))
         {
-            COUT(0) << "Error: \"" << gametype << "\" is not a valid gametype." << std::endl;
+            orxout(internal_error) << "\"" << gametype << "\" is not a valid gametype." << endl;
             identifier = Class(Gametype);
             this->gametype_ = "Gametype";
@@ -157,5 +157,5 @@
 //         this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
         if( this->lodInformation_.find(meshName) != this->lodInformation_.end())
-          CCOUT(4) << "replacing lod information for " << meshName << endl;
+            orxout(verbose, context::lod) << "replacing lod information for " << meshName << endl;
         this->lodInformation_[meshName] = lodInformation;
     }
@@ -171,5 +171,5 @@
     void Level::playerEntered(PlayerInfo* player)
     {
-        COUT(3) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << std::endl;
+        orxout(internal_info) << "player entered level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl;
         player->setGametype(this->getGametype());
     }
@@ -177,5 +177,5 @@
     void Level::playerLeft(PlayerInfo* player)
     {
-        COUT(3) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << std::endl;
+        orxout(internal_info) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl;
         player->setGametype(0);
     }
Index: code/trunk/src/orxonox/LevelInfo.cc
===================================================================
--- code/trunk/src/orxonox/LevelInfo.cc	(revision 8857)
+++ code/trunk/src/orxonox/LevelInfo.cc	(revision 8858)
@@ -125,5 +125,5 @@
         if(!this->validateTag(tag))
         {
-            COUT(2) << "Bad LevelInfo tag '" << tag << "' in " << this->getXMLFilename() << ". Ignoring..." << std::endl;
+            orxout(internal_warning) << "Bad LevelInfo tag '" << tag << "' in " << this->getXMLFilename() << ". Ignoring..." << endl;
             return false;
         }
Index: code/trunk/src/orxonox/LevelManager.cc
===================================================================
--- code/trunk/src/orxonox/LevelManager.cc	(revision 8857)
+++ code/trunk/src/orxonox/LevelManager.cc	(revision 8858)
@@ -251,5 +251,5 @@
 
         // Iterate over all the found *.oxw files
-        COUT(3) << "Loading LevelInfos..." << std::endl;
+        orxout(internal_info) << "Loading LevelInfos..." << endl;
         std::set<std::string> names;
         for (Ogre::StringVector::const_iterator it = levels->begin(); it != levels->end(); ++it)
@@ -281,10 +281,10 @@
                 // Warn about levels with the same name.
                 if(!names.insert(info->getName()).second)
-                    COUT(2) << "Warning: Multiple levels (" << info->getXMLFilename() << ") with name '" << info->getName() << "' found!" << std::endl;
+                    orxout(internal_warning) << "Multiple levels (" << info->getXMLFilename() << ") with name '" << info->getName() << "' found!" << endl;
 
                 // Warn about multiple items so that it gets fixed quickly
                 if(availableLevels_.find(info) != availableLevels_.end())
                 {
-                    COUT(2) << "Warning: Multiple levels (" << info->getXMLFilename() << ") with same name '" << info->getName() << "' and filename found! Exluding..." << std::endl;
+                    orxout(internal_warning) << "Multiple levels (" << info->getXMLFilename() << ") with same name '" << info->getName() << "' and filename found! Exluding..." << endl;
                     // Delete LevelInfoItem to avoid a dangling pointer
                     delete info;
Index: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc	(revision 8857)
+++ code/trunk/src/orxonox/Main.cc	(revision 8858)
@@ -61,8 +61,15 @@
     int main(const std::string& strCmdLine)
     {
+        orxout(internal_status) << "entering orxonox::main()" << endl;
+        orxout(internal_info) << "command line: " << strCmdLine << endl;
+
+        orxout(internal_info) << "creating Game object:" << endl;
         Game* game = new Game(strCmdLine);
+        orxout(user_status) << "Finished initialization" << endl;
 
         if (CommandLineParser::getValue("generateDoc").getString().empty())
         {
+            orxout(internal_info) << "preparing game states" << endl;
+
             /* TODO make this clear */
             game->setStateHierarchy(
@@ -98,4 +105,5 @@
             }
 
+            orxout(internal_info) << "starting game" << endl;
             game->run();
         }
Index: code/trunk/src/orxonox/MoodManager.cc
===================================================================
--- code/trunk/src/orxonox/MoodManager.cc	(revision 8857)
+++ code/trunk/src/orxonox/MoodManager.cc	(revision 8858)
@@ -54,5 +54,5 @@
         {
             // TODO: Non-fatal error handling (non-critical resource missing)
-            COUT(2) << "Mood Warning: Folder for default mood (" << MoodManager::defaultMood_ << ") does not exist!" << std::endl;
+            orxout(internal_warning) << "Mood Warning: Folder for default mood (" << MoodManager::defaultMood_ << ") does not exist!" << endl;
         }
         
@@ -82,10 +82,10 @@
         if (!Resource::exists(path))
         {
-            COUT(3) << "Mood " << mood_ << " does not exist. Will not change." << std::endl;
+            orxout(internal_warning) << "Mood " << mood_ << " does not exist. Will not change." << endl;
             this->setMood(oldMood_);
         }
         else
         {
-            COUT(3) << "Mood changed to " << mood_ << std::endl;
+            orxout(internal_info) << "Mood changed to " << mood_ << endl;
             MoodListener::changedMood(mood_);
         }
Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 8857)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 8858)
@@ -77,4 +77,10 @@
     class Radar;
     class Scene;
+
+    // chat
+    class ChatHistory;
+    class ChatInputHandler;
+    class ChatListener;
+    class ChatManager;
 
     // collisionshapes
Index: code/trunk/src/orxonox/PlayerManager.cc
===================================================================
--- code/trunk/src/orxonox/PlayerManager.cc	(revision 8857)
+++ code/trunk/src/orxonox/PlayerManager.cc	(revision 8858)
@@ -57,5 +57,5 @@
         {
             if (clientID != 0)
-                COUT(3) << "client connected" << std::endl;
+                orxout(internal_info) << "client connected" << endl;
 
             // create new HumanPlayer instance
@@ -77,5 +77,5 @@
         {
             if (clientID != 0)
-                COUT(3) << "client disconnected" << std::endl;
+                orxout(internal_info) << "client disconnected" << endl;
 
             // remove from clients-map
Index: code/trunk/src/orxonox/Radar.cc
===================================================================
--- code/trunk/src/orxonox/Radar.cc	(revision 8857)
+++ code/trunk/src/orxonox/Radar.cc	(revision 8858)
@@ -195,10 +195,10 @@
     void Radar::listObjects() const
     {
-        COUT(3) << "List of RadarObjects:\n";
+        orxout(debug_output) << "List of RadarObjects:" << endl;
         // iterate through all Radar Objects
         unsigned int i = 0;
         for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it, ++i)
         {
-            COUT(3) << i++ << ": " << (*it)->getRVWorldPosition() << std::endl;
+            orxout(debug_output) << i++ << ": " << (*it)->getRVWorldPosition() << endl;
         }
     }
Index: code/trunk/src/orxonox/Scene.cc
===================================================================
--- code/trunk/src/orxonox/Scene.cc	(revision 8857)
+++ code/trunk/src/orxonox/Scene.cc	(revision 8858)
@@ -141,11 +141,11 @@
         if (range.length() < 10.0f)
         {
-            CCOUT(2) << "Warning: Setting the negative world range to a very small value: "
-                     << multi_cast<std::string>(range) << std::endl;
-        }
-        if (this->hasPhysics())
-        {
-            CCOUT(2) << "Warning: Attempting to set the physical world range at run time. "
-                     << "This causes a complete physical reload which might take some time." << std::endl;
+            orxout(internal_warning) << "Setting the negative world range to a very small value: "
+                                     << multi_cast<std::string>(range) << endl;
+        }
+        if (this->hasPhysics())
+        {
+            orxout(internal_warning) << "Attempting to set the physical world range at run time. "
+                                     << "This causes a complete physical reload which might take some time." << endl;
             this->setPhysicalWorld(false);
             this->negativeWorldRange_ = range;
@@ -160,11 +160,11 @@
         if (range.length() < 10.0f)
         {
-            CCOUT(2) << "Warning: Setting the positive world range to a very small value: "
-                     << multi_cast<std::string>(range) << std::endl;
-        }
-        if (this->hasPhysics())
-        {
-            CCOUT(2) << "Warning: Attempting to set the physical world range at run time. "
-                     << "This causes a complete physical reload which might take some time." << std::endl;
+            orxout(internal_warning) << "Setting the positive world range to a very small value: "
+                                     << multi_cast<std::string>(range) << endl;
+        }
+        if (this->hasPhysics())
+        {
+            orxout(internal_warning) << "Attempting to set the physical world range at run time. "
+                                     << "This causes a complete physical reload which might take some time." << endl;
             this->setPhysicalWorld(false);
             this->positiveWorldRange_ = range;
Index: code/trunk/src/orxonox/Test.cc
===================================================================
--- code/trunk/src/orxonox/Test.cc	(revision 8857)
+++ code/trunk/src/orxonox/Test.cc	(revision 8858)
@@ -127,5 +127,5 @@
     //     mt2.importData( temp );
     //     assert( temp-mem == mt1.getNetworkSize() );
-    //     COUT(0) << mt2 << endl;
+    //     orxout() << mt2 << endl;
     //     if(!Core::isMaster())
     //       call2(0, "bal", "a", "n", "ce");
@@ -135,18 +135,18 @@
     void Test::printBlaBla(std::string s1, std::string s2, std::string s3, std::string s4, std::string s5)
     {
-        COUT(0) << s1 << s2 << s3 << s4 << s5 << endl;
+        orxout() << s1 << s2 << s3 << s4 << s5 << endl;
     }
 
-    void Test::checkU1(){ COUT(1) << "U1 changed: " << u1 << std::endl; }
-    void Test::checkU2(){ COUT(1) << "U2 changed: " << u2 << std::endl; }
-    void Test::checkU3(){ COUT(1) << "U3 changed: " << u3 << std::endl; }
-    void Test::checkU4(){ COUT(1) << "U4 changed: " << u4 << std::endl; }
+    void Test::checkU1(){ orxout() << "U1 changed: " << u1 << endl; }
+    void Test::checkU2(){ orxout() << "U2 changed: " << u2 << endl; }
+    void Test::checkU3(){ orxout() << "U3 changed: " << u3 << endl; }
+    void Test::checkU4(){ orxout() << "U4 changed: " << u4 << endl; }
 
-    void Test::checkS1(){ COUT(1) << "S1 changed: " << s1 << std::endl; }
-    void Test::checkS2(){ COUT(1) << "S2 changed: " << s2 << std::endl; }
-    void Test::checkS3(){ COUT(1) << "S3 changed: " << s3 << std::endl; }
-    void Test::checkS4(){ COUT(1) << "S4 changed: " << s4 << std::endl; }
+    void Test::checkS1(){ orxout() << "S1 changed: " << s1 << endl; }
+    void Test::checkS2(){ orxout() << "S2 changed: " << s2 << endl; }
+    void Test::checkS3(){ orxout() << "S3 changed: " << s3 << endl; }
+    void Test::checkS4(){ orxout() << "S4 changed: " << s4 << endl; }
 
-    void Test::printPointer(){ CCOUT(1) << "pointer: " << this->pointer_ << endl; }
+    void Test::printPointer(){ orxout() << "pointer: " << this->pointer_ << endl; }
 
 }
Index: code/trunk/src/orxonox/Test.h
===================================================================
--- code/trunk/src/orxonox/Test.h	(revision 8857)
+++ code/trunk/src/orxonox/Test.h	(revision 8858)
@@ -108,5 +108,5 @@
       
       void blub2()
-      { for( std::set<uint32_t>::iterator it=mySet_.begin(); it!=mySet_.end(); ++it ) COUT(0) << *it << endl; }
+      { for( std::set<uint32_t>::iterator it=mySet_.begin(); it!=mySet_.end(); ++it ) orxout() << *it << endl; }
   };
 }
Index: code/trunk/src/orxonox/chat/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/chat/CMakeLists.txt	(revision 8858)
+++ code/trunk/src/orxonox/chat/CMakeLists.txt	(revision 8858)
@@ -0,0 +1,5 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+  ChatHistory.cc
+  ChatInputHandler.cc
+  ChatManager.cc
+)
Index: code/trunk/src/orxonox/chat/ChatHistory.cc
===================================================================
--- code/trunk/src/orxonox/chat/ChatHistory.cc	(revision 8858)
+++ code/trunk/src/orxonox/chat/ChatHistory.cc	(revision 8858)
@@ -0,0 +1,172 @@
+/*
+ *   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:
+ *      Sandro 'smerkli' Merkli
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ChatHistory.h"
+#include "util/ScopedSingletonManager.h"
+
+#ifndef CHATTEST
+namespace orxonox
+{
+  /* singleton */
+  ManageScopedSingleton( ChatHistory, ScopeID::Root, false );
+#endif
+
+  /* constructor */
+#ifndef CHATTEST
+  //ChatHistory::ChatHistory( BaseObject* creator ) : BaseObject(creator)
+  ChatHistory::ChatHistory()
+#else
+  ChatHistory::ChatHistory()
+#endif
+  {
+    /* register the object */
+#ifndef CHATTEST
+    RegisterObject(ChatHistory);
+#endif
+
+    this->hist_log_enabled = true;
+
+    /* Read setting for logfiles */
+    if( hist_log_enabled ) /* NOTE Make this a check for the logfile setting */
+    { this->chat_hist_openlog();
+
+      /* push starting line */
+      this->chat_hist_logline( "--- Logfile opened ---" );
+    }
+
+    /* Read setting for maximum number of lines and set limit */
+    this->hist_maxlines = 200; /* NOTE to be changed, 200 is just for testing */
+  }
+
+  /* destructor */
+  ChatHistory::~ChatHistory()
+  {
+    chat_hist_closelog();
+
+    /* clear list */
+    this->hist_buffer.clear();
+  }
+
+  /* react to incoming chat */
+  void ChatHistory::incomingChat(const std::string& message, const std::string& /*name*/)
+  {
+    /* add the line to the history */
+    this->chat_hist_addline( message );
+
+    /* add the line to the log */
+    this->chat_hist_logline( message );
+  }
+
+  /* Synchronize logfile onto the hard drive */ /* MARK MARK */
+  int ChatHistory::syncLog()
+  {
+    //if( this->hist_logfile )
+      //this->hist_logfile.sync();
+    return 0;
+  }
+
+  /* add a line to this history */
+  int ChatHistory::chat_hist_addline( const std::string& toadd )
+  {
+    /* crop history at the end if it's too large */
+    while( this->hist_buffer.size() > this->hist_maxlines+1 )
+      this->hist_buffer.pop_front();
+
+    /* push to the front of the history */
+    this->hist_buffer.push_back( toadd );
+    return 0;
+  }
+
+  /* log a line to a logfile */
+  int ChatHistory::chat_hist_logline( const std::string& toadd )
+  {
+    /* output the line to the file if logging is enabled */
+    if( this->hist_log_enabled )
+      this->hist_logfile << toadd << endl;
+    return 0;
+  }
+
+  /* open logfile */
+  int ChatHistory::chat_hist_openlog()
+  {
+    /* TODO: find out the name of the file to log to via settings
+     *       and set the this->hist_logfile_path variable to it
+     */
+#ifndef CHATTEST
+    this->hist_logfile.open( (PathConfig::getInstance().getLogPathString() +
+      "chatlog.log").c_str(),
+      std::fstream::out | std::fstream::app );
+#else
+    this->hist_logfile.open( "/tmp/chatlog.log",
+      std::fstream::out | std::fstream::app );
+#endif
+
+    /* TODO check whether this works (not sure how you'd like it?) */
+    if( !this->hist_logfile )
+    { this->hist_log_enabled = false;
+#ifndef CHATTEST
+      orxout(internal_warning) << "Could not open logfile." << endl;
+#endif
+    }
+
+    /* if it worked */
+    return 0;
+  }
+
+  /* close logfile */
+  void ChatHistory::chat_hist_closelog()
+  {
+    /* see if we've actually got a logfile */
+    if( this->hist_logfile )
+    {
+      /* yes, we've got one, add a line that shows we're closing it */
+      this->chat_hist_logline( "--- Logfile closed ---" );
+
+      /* actually close down the file */
+      this->hist_logfile.close();
+    }
+  }
+
+  /* output history for debugging */
+  void ChatHistory::debug_printhist()
+  {
+    /* create deque iterator */
+    std::deque<std::string>::iterator it;
+
+    /* output all the strings */
+    for( it = this->hist_buffer.begin(); it != this->hist_buffer.end();
+      ++it )
+      orxout(debug_output) << *it << endl;
+
+    /* output size */
+    orxout(debug_output) << "Size: " << hist_buffer.size() << endl;
+  }
+
+#ifndef CHATTEST
+}
+#endif
Index: code/trunk/src/orxonox/chat/ChatHistory.h
===================================================================
--- code/trunk/src/orxonox/chat/ChatHistory.h	(revision 8858)
+++ code/trunk/src/orxonox/chat/ChatHistory.h	(revision 8858)
@@ -0,0 +1,149 @@
+/*
+ *   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:
+ *      Sandro 'smerkli' Merkli
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include <deque>
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <cassert>
+
+/* define this if you're unit testing */
+//#define CHATTEST
+
+#ifndef CHATTEST
+#include "OrxonoxPrereqs.h"
+
+#include "util/Singleton.h"
+#include "core/BaseObject.h"
+#include "core/PathConfig.h"
+#include "chat/ChatListener.h"
+#include "infos/PlayerInfo.h"
+#include "PlayerManager.h"
+#endif
+
+#ifndef _ChatHistory_H__
+#define _ChatHistory_H__
+
+
+/* Class to implement chat history */
+#ifndef CHATTEST
+namespace orxonox
+{
+#endif
+
+  /* constructor */
+#ifndef CHATTEST
+  class _OrxonoxExport ChatHistory : public ChatListener,
+    public Singleton<ChatHistory>
+
+#else
+  class ChatHistory
+#endif
+  {
+    public:
+      /* constructors, destructors */
+#ifndef CHATTEST
+      ChatHistory();
+      friend class Singleton<ChatHistory>;
+#else
+      ChatHistory();
+#endif
+      virtual ~ChatHistory();
+
+
+    //protected:
+      /** what to do with incoming chat
+       *
+       * \param message The incoming message
+       * \param senderID Identification number of the sender
+       */
+      virtual void incomingChat(const std::string& message, const std::string& name);
+
+      /** Synchronize logfile onto the hard drive
+       *
+       * \return 0 for success, other for error
+       */
+      int syncLog();
+
+      /** debug-print: output the whole history to stdout */
+      void debug_printhist();
+
+    private:
+      /* FIELDS */
+      /** Vector to store the history in */
+      std::deque<std::string> hist_buffer;
+
+      /** Maximum number of lines stored in this history */
+      unsigned int hist_maxlines;
+
+      /** is logging enabled? */
+      bool hist_log_enabled;
+
+      /** path of logfile on the file system */
+      std::string hist_logfile_path;
+
+      /** Output file stream for logfile */
+      std::ofstream hist_logfile;
+
+#ifndef CHATTEST
+      static ChatHistory* singletonPtr_s;
+#endif
+
+
+
+      /* METHODS */
+      /** Append line to chat history
+       *
+       * \param toadd The line to add to the history
+       * \return 0 for success, other for error TODO: Throw exception
+       */
+      int chat_hist_addline( const std::string& toadd );
+
+      /** Append line to logfile
+       *
+       * \param toadd The line to add to the logfile
+       * \return 0 for success, other for error TODO: Throw exception
+       */
+      int chat_hist_logline( const std::string& toadd );
+
+      /** open logfile to log to
+       *
+       * \return 0 for success,s other for error
+       */
+      int chat_hist_openlog();
+
+
+      /** close logfile */
+      void chat_hist_closelog();
+  };
+
+#ifndef CHATTEST
+}
+#endif
+
+#endif /* _ChatHistory_H__ */
Index: code/trunk/src/orxonox/chat/ChatInputHandler.cc
===================================================================
--- code/trunk/src/orxonox/chat/ChatInputHandler.cc	(revision 8858)
+++ code/trunk/src/orxonox/chat/ChatInputHandler.cc	(revision 8858)
@@ -0,0 +1,342 @@
+/*
+ *   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:
+ *      Sandro 'smerkli' Merkli
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ChatInputHandler.h"
+
+#include <cassert>
+#include <string>
+#include <CEGUIWindow.h>
+#include <CEGUIWindowManager.h>
+#include <elements/CEGUIListbox.h>
+#include <elements/CEGUIListboxItem.h>
+#include <elements/CEGUIListboxTextItem.h>
+
+#include "util/ScopedSingletonManager.h"
+#include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
+#include "core/command/ConsoleCommand.h"
+#include "core/input/InputBuffer.h"
+#include "core/input/InputManager.h"
+#include "core/input/InputState.h"
+
+#include "chat/ChatManager.h"
+#include "PlayerManager.h"
+#include "infos/PlayerInfo.h"
+
+namespace orxonox
+{
+  /* singleton */
+  ManageScopedSingleton( ChatInputHandler, ScopeID::Graphics, false );
+
+  /* add commands to console */
+  SetConsoleCommand( "startchat", &ChatInputHandler::activate_static );
+  SetConsoleCommand( "startchat_small", &ChatInputHandler::activate_small_static );
+
+  /* constructor */
+  ChatInputHandler::ChatInputHandler()
+  {
+    /* register the object  */
+    RegisterObject(ChatInputHandler);
+
+    /* create necessary objects */
+    this->inpbuf = new InputBuffer();
+    this->disp_offset = 0;
+    assert( this->inpbuf != NULL );
+
+    /* generate chatbox ui and chatbox-inputonly ui */
+    GUIManager::getInstance().loadGUI( "ChatBox" );
+    GUIManager::getInstance().loadGUI( "ChatBox-inputonly" );
+
+    /* setup colors */
+    setupColors();
+
+    /* configure the input buffer */
+    configureInputBuffer();
+
+    this->inputState = InputManager::getInstance().createInputState( "chatinput", false, false, InputStatePriority::Dynamic );
+    this->inputState->setKeyHandler(this->inpbuf);
+  }
+
+  ChatInputHandler::~ChatInputHandler()
+  {
+    /* Clean up */
+    InputManager::getInstance().destroyState("chatinput");
+    delete this->inpbuf;
+  }
+
+  /* configure input buffer, sub for the constructor */
+  void ChatInputHandler::configureInputBuffer()
+  {
+    /* INSTALL CALLBACKS */
+    /* input has changed */
+    this->inpbuf->registerListener(this, &ChatInputHandler::inputChanged, true);
+
+    /* add a line */
+    this->inpbuf->registerListener(this, &ChatInputHandler::addline,         '\r',   false);
+    this->inpbuf->registerListener(this, &ChatInputHandler::addline,         '\n',   false);
+
+    /* backspace */
+    this->inpbuf->registerListener(this, &ChatInputHandler::backspace,       '\b',   true);
+    //this->inpbuf->registerListener(this, &ChatInputHandler::backspace,       '\177', true);
+
+    /* exit the chatinputhandler thingy (tbd) */
+    this->inpbuf->registerListener(this, &ChatInputHandler::exit,            '\033', true); // escape
+
+    /* delete character */
+    this->inpbuf->registerListener(this, &ChatInputHandler::deleteChar,      KeyCode::Delete);
+
+    /* cursor movement */
+    this->inpbuf->registerListener(this, &ChatInputHandler::cursorRight,     KeyCode::Right);
+    this->inpbuf->registerListener(this, &ChatInputHandler::cursorLeft,      KeyCode::Left);
+    this->inpbuf->registerListener(this, &ChatInputHandler::cursorEnd,       KeyCode::End);
+    this->inpbuf->registerListener(this, &ChatInputHandler::cursorHome,      KeyCode::Home);
+
+    /* GET WINDOW POINTERS */
+    input = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/input" );
+    inputonly = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox-inputonly/input" );
+
+    /* get pointer to the history window */
+    CEGUI::Window *history = CEGUI::WindowManager::getSingleton().getWindow( "orxonox/ChatBox/history" );
+
+    /* cast it to a listbox */
+    lb_history = dynamic_cast<CEGUI::Listbox*>(history);
+
+    /* assert wee */
+    assert( lb_history );
+  }
+
+  /* setup the colors, sub for the constructor */
+  void ChatInputHandler::setupColors()
+  {
+    /* auto variables */
+    float red = 1.0, green = 0.5, blue = 0.5;
+    int i = 0;
+
+    // three loops: red tones, blue tones and green tones
+    // reds
+    for( i = 0; i < NumberOfColors/3; ++i )
+    { this->text_colors[ i ] = CEGUI::colour( red, green, blue );
+      green += 0.2f, blue += 0.2f;
+    }
+
+    // greens
+    red = 0.5, green = 1, blue = 0.5;
+    for( ; i < NumberOfColors*2/3; ++i )
+    { this->text_colors[ i ] = CEGUI::colour( red, green, blue );
+      red += 0.2f, blue += 0.2f;
+    }
+
+    // blues
+    red = 0.5, green = 0.5, blue = 1;
+    for( ; i < NumberOfColors; ++i )
+    { this->text_colors[ i ] = CEGUI::colour( red, green, blue );
+      red += 0.2f, green += 0.2f;
+    }
+  }
+
+
+  /* activate, deactivate */
+  void ChatInputHandler::activate_static()
+  { ChatInputHandler::getInstance().activate( true ); }
+
+  void ChatInputHandler::activate_small_static()
+  { ChatInputHandler::getInstance().activate( false ); }
+
+  void ChatInputHandler::activate( bool full )
+  {
+    /* start listening */
+    InputManager::getInstance().enterState("chatinput");
+
+    /* MARK add spawning of chat widget stuff here.*/
+    if( full )
+      GUIManager::getInstance().showGUI( "ChatBox" );
+    else
+      GUIManager::getInstance().showGUI( "ChatBox-inputonly" );
+
+    this->fullchat = full;
+  }
+
+  void ChatInputHandler::deactivate()
+  {
+    /* stop listening */
+    InputManager::getInstance().leaveState("chatinput");
+
+    /* un-spawning of chat widget stuff */
+    GUIManager::getInstance().hideGUI( "ChatBox" );
+    GUIManager::getInstance().hideGUI( "ChatBox-inputonly" );
+  }
+
+
+  /* subs for incomingChat */
+  void ChatInputHandler::sub_setcolor( CEGUI::ListboxTextItem *tocolor,
+    std::string name )
+  {
+    /* sanity checks */
+    if( !tocolor )
+      orxout(internal_warning) << "Empty ListBoxTextItem given to "
+        "ChatInputhandler::sub_setcolor()." << endl;
+
+    /* "hash" the name */
+    int hash = 0;
+    for( int i = name.length(); i > 0; --i )
+      hash += name[i-1];
+    hash = hash % this->NumberOfColors;
+
+    /* set the color according to the hash */
+    tocolor->setTextColours( this->text_colors[ hash ] );
+  }
+
+  /* handle incoming chat */
+  void ChatInputHandler::incomingChat(const std::string& message, const std::string& name)
+  {
+    /* create item */
+    CEGUI::ListboxTextItem *toadd = new CEGUI::ListboxTextItem( message );
+
+    /* setup colors */
+    if (name != "")
+      sub_setcolor( toadd, name );
+
+    /* now add */
+    this->lb_history->addItem( dynamic_cast<CEGUI::ListboxItem*>(toadd) );
+    this->lb_history->ensureItemIsVisible(
+      dynamic_cast<CEGUI::ListboxItem*>(toadd) );
+
+    /* make sure the history handles it */
+    this->lb_history->handleUpdatedItemData();
+  }
+
+
+  /* sub for inputchanged */
+  void ChatInputHandler::sub_adjust_dispoffset( int maxlen,
+    int cursorpos,
+    int inplen )
+  {
+    /* already start offsetting 5 characters before end */
+    if( cursorpos+5 > maxlen )
+    {
+      /* always stay 5 characters ahead of end, looks better */
+      ((disp_offset = cursorpos-maxlen+5) >= 0) ? 1 : disp_offset = 0;
+
+      /* enforce visibility of cursor */
+      (disp_offset > cursorpos ) ? disp_offset = 0 : 1;
+    }
+
+    /* make sure we don't die at substr */
+    if( inplen <= disp_offset ) disp_offset = 0;
+  }
+
+  /* callbacks for InputBuffer */
+  void ChatInputHandler::inputChanged()
+  {
+    /* update the cursor and the window */
+    std::string raw = this->inpbuf->get();
+    int cursorpos = this->inpbuf->getCursorPosition();
+
+    /* get string before cursor */
+    std::string left = raw.substr( 0, cursorpos );
+
+    /* see if there's a string after the cursor */
+    std::string right = "";
+    if( raw.length() >= left.length()+1 )
+      right = raw.substr( cursorpos );
+
+    /* set the text */
+    std::string assembled = "$ " + left + "|" + right;
+
+    if( this->fullchat )
+    {
+      /* adjust curser position - magic number 5 for font width */
+      sub_adjust_dispoffset( (int)(this->input->getUnclippedInnerRect().getWidth()/6),
+        cursorpos, assembled.length() );
+      this->input->setProperty( "Text", assembled.substr( disp_offset ) );
+    }
+    else
+    {
+      /* adjust curser position - magic number 5 for font width */
+      sub_adjust_dispoffset( (int)(this->inputonly->getUnclippedInnerRect().getWidth()/6),
+        cursorpos, assembled.length() );
+      this->inputonly->setProperty( "Text", assembled.substr( disp_offset) );
+    }
+
+    /* reset display offset */
+    disp_offset = 0;
+  }
+
+  void ChatInputHandler::addline()
+  {
+    /* actually do send what was input */
+    /* a) get the string out of the inputbuffer */
+    std::string msgtosend = this->inpbuf->get();
+
+    if( msgtosend.length() == 0 )
+    { this->deactivate();
+      return;
+    }
+
+    /* b) clear the input buffer */
+    if (this->inpbuf->getSize() > 0)
+      this->inpbuf->clear();
+
+    /* c) send the chat via some call */
+    ChatManager::chat( msgtosend );
+
+    /* d) stop listening to input - only if this is not fullchat */
+    if( !this->fullchat )
+      this->deactivate();
+
+  }
+
+  void ChatInputHandler::backspace()
+  { this->inpbuf->removeBehindCursor(); }
+
+  void ChatInputHandler::deleteChar()
+  { this->inpbuf->removeAtCursor(); }
+
+  void ChatInputHandler::cursorRight()
+  { this->inpbuf->increaseCursor(); }
+
+  void ChatInputHandler::cursorLeft()
+  { this->inpbuf->decreaseCursor(); }
+
+  void ChatInputHandler::cursorEnd()
+  { this->inpbuf->setCursorToEnd(); }
+
+  void ChatInputHandler::cursorHome()
+  { this->inpbuf->setCursorToBegin(); }
+
+  void ChatInputHandler::exit()
+  {
+    /* b) clear the input buffer */
+    if (this->inpbuf->getSize() > 0)
+      this->inpbuf->clear();
+
+    /* d) stop listening to input  */
+    this->deactivate();
+  }
+
+}
Index: code/trunk/src/orxonox/chat/ChatInputHandler.h
===================================================================
--- code/trunk/src/orxonox/chat/ChatInputHandler.h	(revision 8858)
+++ code/trunk/src/orxonox/chat/ChatInputHandler.h	(revision 8858)
@@ -0,0 +1,133 @@
+/*
+ *   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:
+ *      Sandro 'smerkli' Merkli
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ChatInputHandler_H__
+#define _ChatInputHandler_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include <CEGUIForwardRefs.h>
+#include <CEGUIcolour.h>
+
+#include "util/Singleton.h"
+#include "chat/ChatListener.h"
+
+namespace orxonox // tolua_export
+{ // tolua_export
+  /* class to handle chat using an InputBuffer */
+  class _OrxonoxExport ChatInputHandler  // tolua_export
+    : public Singleton<ChatInputHandler>, public ChatListener
+  { // tolua_export
+    private:
+      /** Input buffer, to be used to catch input from the
+       * keyboard
+       */
+      InputBuffer *inpbuf;
+      int disp_offset, width;
+      bool fullchat;
+
+      /* colors for nickname coloring */
+      static const int NumberOfColors = 10;
+      CEGUI::colour text_colors[ NumberOfColors ];
+
+      /** input state */
+      InputState *inputState;
+
+      /** setup input buffer, the constructor calls this */
+      void configureInputBuffer();
+
+      /** adjust display offset depending on cursor position */
+      void sub_adjust_dispoffset( int maxlen, int cursorpos, int inplen );
+
+      /** singleton pointer */
+      static ChatInputHandler* singletonPtr_s;
+
+      /** cegui window handles */
+      CEGUI::Window *input, *inputonly;
+
+      /** cegui handle for the history window */
+      CEGUI::Listbox *lb_history;
+
+      /* methods to deal with colors */
+      void sub_setcolor( CEGUI::ListboxTextItem *tocolor,
+        std::string name );
+
+      void setupColors();
+
+      /* callbacks for input handler */
+      void inputChanged();
+      void addline();
+      void backspace();
+      void deleteChar();
+      void cursorRight();
+      void cursorLeft();
+      void cursorEnd();
+      void cursorHome();
+      void exit();
+
+    public:
+      /** constructor */
+      ChatInputHandler();
+      ~ChatInputHandler();
+      friend class Singleton<ChatInputHandler>;
+
+      static ChatInputHandler& getInstance(void) { return Singleton<ChatInputHandler>::getInstance(); }  // tolua_export
+
+      /** start listening */
+      static void activate_static();
+
+      /** stop listening */
+      static void activate_small_static();
+
+      /** \param message the message text
+       * \param senderID ID of the player who sent the message
+       *
+       * Deal with incoming chat (which means in our case: Add it to the
+       * history window of the full chat window)
+       */
+      void incomingChat(const std::string& message, const std::string& name);
+
+      /** \param full true means show full chat window with history,
+            false means show only an input line
+       *
+       * Show the chat window and redirect the game's keyboard input
+       * into it.
+       */
+      void activate( bool full );
+
+      /** Deactivate the chat window, meaning: hide it. */
+      void deactivate();  // tolua_export
+
+  };  // tolua_export
+
+
+}  // tolua_export
+
+
+#endif /*_ChatInputHandler_H__*/
Index: code/trunk/src/orxonox/chat/ChatListener.h
===================================================================
--- code/trunk/src/orxonox/chat/ChatListener.h	(revision 8858)
+++ code/trunk/src/orxonox/chat/ChatListener.h	(revision 8858)
@@ -0,0 +1,60 @@
+/*
+ *   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 _ChatListener_H__
+#define _ChatListener_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+    /**
+        @brief Classes inheriting from this interface get a notification whenever a chat
+        message was sent through ChatManager.
+    */
+    class _OrxonoxExport ChatListener : virtual public OrxonoxClass
+    {
+        friend class ChatManager;
+
+        public:
+            ChatListener(); // implemented in ChatManager.cc
+            virtual ~ChatListener() {}
+
+        protected:
+            /**
+                @brief Gets called whenever a chat message was sent through ChatManager.
+                @param message The whole message (including name of the sender if available)
+                @param name The name of the sender (if available, otherwise "")
+            */
+            virtual void incomingChat(const std::string& message, const std::string& name) = 0;
+    };
+}
+
+#endif /* _ChatListener_H__ */
Index: code/trunk/src/orxonox/chat/ChatManager.cc
===================================================================
--- code/trunk/src/orxonox/chat/ChatManager.cc	(revision 8858)
+++ code/trunk/src/orxonox/chat/ChatManager.cc	(revision 8858)
@@ -0,0 +1,120 @@
+/*
+ *   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 "ChatManager.h"
+#include "ChatListener.h"
+
+#include "util/ScopedSingletonManager.h"
+#include "core/CoreIncludes.h"
+#include "core/command/ConsoleCommand.h"
+#include "network/Host.h"
+
+#include "PlayerManager.h"
+#include "infos/PlayerInfo.h"
+
+namespace orxonox
+{
+    ManageScopedSingleton(ChatManager, ScopeID::Root, false);
+
+    SetConsoleCommand("chat", &ChatManager::chat).defaultValue(1, NETWORK_PEER_ID_BROADCAST);
+
+    ChatManager::ChatManager()
+    {
+        RegisterObject(ChatManager);
+    }
+
+    /**
+        @brief Sends a message (usually gameplay related) without explicit sender to the chat.
+        @param message The message
+        @param targetID The client ID (network) of the receiver. Usually the broadcast ID
+    */
+    /*static*/ void ChatManager::message(const std::string& message, unsigned int targetID)
+    {
+        unsigned int sourceID = NETWORK_PEER_ID_UNKNOWN;
+
+        // only the server should send gameplay messages through the network. otherwise display the message locally
+        if (GameMode::isServer())
+            Host::sendChat(message, sourceID, targetID);
+        else
+            ChatManager::getInstance().incomingChat(message, sourceID);
+    }
+
+    /**
+        @brief Sends a chat message with the client as its sender to the chat.
+        @param message The message
+        @param targetID The client ID (network) of the receiver. Usually the broadcast ID
+    */
+    /*static*/ void ChatManager::chat(const std::string& message, unsigned int targetID)
+    {
+        unsigned int sourceID = Host::getPlayerID();
+
+        // if connected to the network, send chat messages online. otherwise display chat locally
+        if (GameMode::isServer() || GameMode::isClient())
+            Host::sendChat(message, sourceID, targetID);
+        else
+            ChatManager::getInstance().incomingChat(message, sourceID);
+    }
+
+    /**
+        @brief Inherited callback from NetworkChatListener, but gets also called directly
+        by ChatManager itself if the client is offline. Distributes an incoming chat message
+        to all ChatListeners.
+        @param message The message
+        @param sourceID The client ID (network) of the sender
+    */
+    void ChatManager::incomingChat(const std::string& message, unsigned int sourceID)
+    {
+        std::string text = message;
+        std::string name;
+
+        // get the name of the sender and prepend it to the text message
+        if (sourceID != NETWORK_PEER_ID_UNKNOWN)
+        {
+            PlayerInfo* player = PlayerManager::getInstance().getClient(sourceID);
+            if (player)
+            {
+                name = player->getName();
+                text = name + ": " + message;
+            }
+        }
+
+        // notify all listeners
+        for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
+            it->incomingChat(text, name);
+    }
+
+
+    //////////////////////////////////////////////////////////////////////////
+    // ChatListener                                                         //
+    //////////////////////////////////////////////////////////////////////////
+
+    ChatListener::ChatListener()
+    {
+        RegisterRootObject(ChatListener);
+    }
+}
Index: code/trunk/src/orxonox/chat/ChatManager.h
===================================================================
--- code/trunk/src/orxonox/chat/ChatManager.h	(revision 8858)
+++ code/trunk/src/orxonox/chat/ChatManager.h	(revision 8858)
@@ -0,0 +1,63 @@
+/*
+ *   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 _ChatManager_H__
+#define _ChatManager_H__
+
+#include "OrxonoxPrereqs.h"
+#include "util/Singleton.h"
+#include "network/NetworkChatListener.h"
+
+namespace orxonox
+{
+    /**
+        @brief This class collects and distributes chat messages. If the client is online,
+        all chat messages are sent and received through the network. Otherwise chat is handled
+        directly by this class.
+    */
+    class _OrxonoxExport ChatManager : public Singleton<ChatManager>, public NetworkChatListener
+    {
+        friend class Singleton<ChatManager>;
+
+        public:
+            ChatManager();
+            virtual ~ChatManager() {}
+
+            static void message(const std::string& message, unsigned int targetID = NETWORK_PEER_ID_BROADCAST);
+            static void chat(const std::string& message, unsigned int targetID = NETWORK_PEER_ID_BROADCAST);
+
+        protected:
+            ChatManager(const ChatManager&);
+
+            virtual void incomingChat(const std::string& message, unsigned int sourceID);
+
+            static ChatManager* singletonPtr_s;
+    };
+}
+
+#endif /* _ChatManager_H__ */
Index: code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CollisionShape.cc	(revision 8857)
+++ code/trunk/src/orxonox/collisionshapes/CollisionShape.cc	(revision 8858)
@@ -203,5 +203,5 @@
         if(scale_.crossProduct(scale).squaredLength() != 0.0f)
         {
-            CCOUT(2) << "Warning: Non-uniform scaling is not yet supported." << endl;
+            orxout(internal_warning) << "Non-uniform scaling is not yet supported." << endl;
             return;
         }
Index: code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc	(revision 8857)
+++ code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc	(revision 8858)
@@ -98,5 +98,5 @@
         if (this->attachedShapes_.find(shape) != this->attachedShapes_.end())
         {
-            CCOUT(2) << "Warning: Attaching a CollisionShape twice is not yet supported." << std::endl;
+            orxout(internal_warning) << "Attaching a CollisionShape twice is not yet supported." << endl;
             return;
         }
@@ -139,5 +139,5 @@
         }
         else
-            CCOUT(2) << "Warning: Cannot detach non child collision shape" << std::endl;
+            orxout(internal_warning) << "Cannot detach non child collision shape" << endl;
     }
 
@@ -168,5 +168,5 @@
         if (it == this->attachedShapes_.end())
         {
-            CCOUT(2) << "Warning: Cannot update child shape: Instance not a child." << std::endl;
+            orxout(internal_warning) << "Cannot update child shape: Instance not a child." << endl;
             return;
         }
Index: code/trunk/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.cc	(revision 8857)
+++ code/trunk/src/orxonox/controllers/ArtificialController.cc	(revision 8858)
@@ -98,5 +98,5 @@
                     if (it->myMaster_ == this)
                     {
-                        COUT(1) << "error: " << this << " is still master in " << (*it) << std::endl;
+                        orxout(internal_error) << this << " is still master in " << (*it) << endl;
                         it->myMaster_ = 0;
                     }
@@ -107,5 +107,5 @@
                         if (it2 != it->slaves_.end())
                         {
-                            COUT(1) << "error: " << this << " is still slave in " << (*it) << std::endl;
+                            orxout(internal_error) << this << " is still slave in " << (*it) << endl;
                             it->slaves_.erase(it2);
                         }
@@ -737,5 +737,5 @@
         float speedDiv = this->getControllableEntity()->getVelocity().squaredLength() - this->target_->getVelocity().squaredLength();
 
-COUT(0) << "~follow distance: " << distance << "SpeedCounter: " << this->speedCounter_ << "~speedDiv: " << speedDiv << std::endl;
+orxout() << "~follow distance: " << distance << "SpeedCounter: " << this->speedCounter_ << "~speedDiv: " << speedDiv << endl;
         if (distance < 800)
         {
Index: code/trunk/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.cc	(revision 8857)
+++ code/trunk/src/orxonox/controllers/HumanController.cc	(revision 8858)
@@ -93,5 +93,5 @@
             Camera* camera = HumanController::localController_s->controllableEntity_->getCamera();
             if (!camera)
-                COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
+                orxout(internal_warning) << "HumanController, Warning: Using a ControllableEntity without Camera" << endl;
         }
     }
@@ -197,5 +197,5 @@
             
             this->controllableEntity_->boost(this->boosting_);
-            COUT(4) << "Start boosting" << endl;
+//            orxout() << "Start boosting" << endl;
         }
     }
@@ -211,5 +211,5 @@
 
         this->controllableEntity_->boost(this->boosting_);
-        COUT(4) << "Stop boosting" << endl;
+//        orxout() << "Stop boosting" << endl;
     }
 
@@ -257,6 +257,6 @@
             const Quaternion& orientation = HumanController::localController_s->controllableEntity_->getOrientation();
 
-            COUT(0) << "position=\"" << position.x << ", " << position.y << ", " << position.z << "\" ";
-            COUT(0) << "orientation=\"" << orientation.w << ", " << orientation.x << ", " << orientation.y << ", " << orientation.z << "\"" << std::endl;
+            orxout(message) << "position=\"" << position.x << ", " << position.y << ", " << position.z << "\" "
+                            << "orientation=\"" << orientation.w << ", " << orientation.x << ", " << orientation.y << ", " << orientation.z << "\"" << endl;
         }
     }
Index: code/trunk/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.cc	(revision 8857)
+++ code/trunk/src/orxonox/controllers/NewHumanController.cc	(revision 8858)
@@ -388,5 +388,5 @@
         for (itr = result.begin(); itr != result.end(); ++itr)
         {
-//             CCOUT(0) << "testing object as target" << endl;
+//             orxout() << "testing object as target" << endl;
             if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" && itr->distance > 200)
             {
Index: code/trunk/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 8857)
+++ code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 8858)
@@ -29,5 +29,4 @@
 #include "GSClient.h"
 
-#include "util/Debug.h"
 #include "util/Exception.h"
 #include "core/CommandLineParser.h"
@@ -53,4 +52,6 @@
     void GSClient::activate()
     {
+        orxout(user_status) << "Starting client" << endl;
+
         GameMode::setIsClient(true);
 
Index: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 8857)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 8858)
@@ -74,4 +74,6 @@
     void GSLevel::activate()
     {
+        orxout(user_status) << "Loading level" << endl;
+
         if (GameMode::showsGraphics())
         {
@@ -155,5 +157,4 @@
 
         // call the loader
-        COUT(0) << "Loading level..." << std::endl;
         startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel());
         bool loaded = Loader::open(startFile_);
@@ -169,5 +170,5 @@
         delete startFile_;
 
-        COUT(3) << "Unloaded level. Remaining objects:" << std::endl;
+        orxout(internal_info) << "Remaining objects:" << endl;
         unsigned int i = 0;
         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
@@ -176,12 +177,12 @@
             if (find == this->staticObjects_.end())
             {
-                COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << std::endl;
+                orxout(internal_info) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;
             }
         }
-        COUT(3) << i << " objects remaining.";
+        orxout(internal_info) << i << " objects remaining.";
         if (i == 0)
-            COUT(3) << " Well done!" << std::endl;
+            orxout(internal_info) << " Well done!" << endl;
         else
-            COUT(3) << " Try harder!" << std::endl;
+            orxout(internal_info) << " Try harder!" << endl;
     }
 
Index: code/trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 8857)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 8858)
@@ -95,4 +95,6 @@
     void GSMainMenu::activate()
     {
+        orxout(user_status) << "Loading main menu" << endl;
+
         // show main menu
         GraphicsManager::getInstance().setCamera(this->camera_);
Index: code/trunk/src/orxonox/gamestates/GSMasterServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMasterServer.cc	(revision 8857)
+++ code/trunk/src/orxonox/gamestates/GSMasterServer.cc	(revision 8858)
@@ -30,5 +30,5 @@
 #include "GSMasterServer.h"
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
@@ -50,10 +50,10 @@
   void GSMasterServer::activate()
   {
+    orxout(user_status) << "Starting masterserver" << endl;
+
     /* TODO make this work for masterserver as well */
     //GameMode::setIsServer(true);
 
     this->mserver = new MasterServer();
-    COUT(0) << "Loading masterserver mode" << std::endl;
-
     this->mserver->run();
   }
Index: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 8857)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 8858)
@@ -77,10 +77,10 @@
         {
             if (dynamic_cast<Synchronisable*>(*it))
-                COUT(0) << "object: " << it->getIdentifier()->getName() << " id: " << dynamic_cast<Synchronisable*>(*it)->getObjectID() << std::endl;
+                orxout(debug_output) << "object: " << it->getIdentifier()->getName() << " id: " << dynamic_cast<Synchronisable*>(*it)->getObjectID() << endl;
             else
-                COUT(0) << "object: " << it->getIdentifier()->getName() << std::endl;
+                orxout(debug_output) << "object: " << it->getIdentifier()->getName() << endl;
             nr++;
         }
-        COUT(0) << "currently got " << nr << " objects" << std::endl;
+        orxout(debug_output) << "currently got " << nr << " objects" << endl;
     }
 
Index: code/trunk/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 8857)
+++ code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 8858)
@@ -29,5 +29,5 @@
 #include "GSServer.h"
 
-#include "util/Debug.h"
+#include "util/Output.h"
 #include "core/CommandLineParser.h"
 #include "core/Game.h"
@@ -54,8 +54,10 @@
     void GSServer::activate()
     {
+        orxout(user_status) << "Starting server" << endl;
+
         GameMode::setIsServer(true);
 
         this->server_ = new Server(CommandLineParser::getValue("port"));
-        COUT(0) << "Loading scene in server mode" << std::endl;
+        orxout(user_status) << "Loading scene in server mode" << endl;
 
         server_->open();
Index: code/trunk/src/orxonox/gametypes/Asteroids.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Asteroids.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/Asteroids.cc	(revision 8858)
@@ -30,5 +30,5 @@
 
 #include "core/CoreIncludes.h"
-#include "network/Host.h"
+#include "chat/ChatManager.h"
 #include "worldentities/pawns/Pawn.h"
 
@@ -74,6 +74,5 @@
 
         std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
 
     }
@@ -84,6 +83,5 @@
 
         std::string message("The match has ended.");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
     }
 }
Index: code/trunk/src/orxonox/gametypes/Deathmatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Deathmatch.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/Deathmatch.cc	(revision 8858)
@@ -30,5 +30,5 @@
 
 #include "core/CoreIncludes.h"
-#include "network/Host.h"
+#include "chat/ChatManager.h"
 #include "infos/PlayerInfo.h"
 #include "worldentities/pawns/Pawn.h"
@@ -48,6 +48,5 @@
 
         std::string message("The match has started!");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
     }
 
@@ -57,6 +56,5 @@
 
         std::string message("The match has ended.");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
     }
 
@@ -66,6 +64,5 @@
 
         const std::string& message = player->getName() + " entered the game";
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
     }
 
@@ -77,6 +74,5 @@
         {
             const std::string& message = player->getName() + " left the game";
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
 
@@ -91,6 +87,5 @@
         {
             const std::string& message = player->getOldName() + " changed name to " + player->getName();
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
 
@@ -113,6 +108,5 @@
                 message = victim->getPlayer()->getName() + " died";
 
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
 
@@ -127,6 +121,5 @@
         {
             const std::string& message = player->getName() + " scores!";
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
     }
Index: code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Dynamicmatch.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/Dynamicmatch.cc	(revision 8858)
@@ -49,5 +49,5 @@
 #include "core/CoreIncludes.h"
 #include "core/command/Executor.h"
-#include "network/Host.h"
+#include "chat/ChatManager.h"
 #include "infos/PlayerInfo.h"
 #include "worldentities/pawns/Pawn.h"
@@ -342,7 +342,6 @@
         numberOf[chaser]++;
         Gametype::playerEntered(player);
-        const std::string& message6 = player->getName() + " entered the game";
-        COUT(0) << message6 << std::endl;
-        Host::Broadcast(message6);
+        const std::string& message = player->getName() + " entered the game";
+        ChatManager::message(message);
     }
 
@@ -359,6 +358,5 @@
             }
             const std::string& message = player->getName() + " left the game";
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
             //remove player from map
             playerParty_.erase (player);
@@ -617,6 +615,5 @@
         {
             const std::string& message = player->getOldName() + " changed name to " + player->getName();
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
 
@@ -630,6 +627,5 @@
         {
             std::string message("Dynamicmatch started!");
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
         else if(tutorial) // Announce selectionphase
@@ -647,6 +643,5 @@
     {
         std::string message("Earn points:\n\n\n\tIf you're red: Chase the blue player!\n\n\tIf you're blue shoot at a red player or hide.\n\n\tIf you're green: You've got the licence to kill red players!");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
         callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::furtherInstructions, this)));
     }
@@ -655,6 +650,5 @@
     {
         std::string message("After 3 Minutes the game is over.");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
     }*/
     void Dynamicmatch::end()
@@ -663,6 +657,5 @@
 
         std::string message("Time out. Press F2 to see the points you scored.");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
     }
     SpawnPoint* Dynamicmatch::getBestSpawnPoint(PlayerInfo* player) const
Index: code/trunk/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Gametype.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/Gametype.cc	(revision 8858)
@@ -297,5 +297,5 @@
             }
             else
-                COUT(2) << "Warning: Killed Pawn was not in the playerlist" << std::endl;
+                orxout(internal_warning) << "Killed Pawn was not in the playerlist" << endl;
         }
     }
@@ -344,5 +344,5 @@
             }
 
-            COUT(2) << "Warning: Fallback SpawnPoint was used, because there were no active SpawnPoints." << endl;
+            orxout(internal_warning) << "Fallback SpawnPoint was used because there were no active SpawnPoints." << endl;
             return fallbackSpawnPoint;
         }
@@ -444,5 +444,5 @@
         else
         {
-            COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
+            orxout(user_error) << "No SpawnPoints in current Gametype" << endl;
             abort();
         }
@@ -461,5 +461,5 @@
         else
         {
-            COUT(1) << "Error: No SpawnPoints in current Gametype" << std::endl;
+            orxout(user_error) << "No SpawnPoints in current Gametype" << endl;
             abort();
         }
Index: code/trunk/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/LastManStanding.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/LastManStanding.cc	(revision 8858)
@@ -30,5 +30,5 @@
 
 #include "core/CoreIncludes.h"
-#include "network/Host.h"
+#include "chat/ChatManager.h"
 #include "infos/PlayerInfo.h"
 #include "worldentities/pawns/Pawn.h"
@@ -90,5 +90,5 @@
                 const std::string& message = ""; // resets Camper-Warning-message
                 this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
-            }    
+            }
         }
         return true;
@@ -105,6 +105,5 @@
             this->playersAlive--;
             const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
 
@@ -128,5 +127,5 @@
     {
         Gametype::end();
-        
+
         for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
         {
@@ -148,5 +147,5 @@
             return 0;
     }
-    
+
     int LastManStanding::getNumPlayersAlive() const
     {
@@ -190,5 +189,5 @@
         this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
         this->playerDelayTime_[player]=respawnDelay;
-        
+
         std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
         if (it != this->players_.end())
@@ -198,5 +197,5 @@
             const std::string& message = ""; // resets Camper-Warning-message
             this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
-        }  
+        }
     }
 
@@ -239,9 +238,9 @@
             }
             for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
-            {   
+            {
                 if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
-                    continue;     
+                    continue;
                 it->second-=dt;//Decreases punishment time.
-                if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 
+                if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
                 {
                     playerDelayTime_[it->first]-=dt;
Index: code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/LastTeamStanding.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/LastTeamStanding.cc	(revision 8858)
@@ -30,6 +30,5 @@
 
 #include "core/CoreIncludes.h"
-#include "network/NetworkPrereqs.h"
-#include "network/Host.h"
+#include "chat/ChatManager.h"
 #include "infos/PlayerInfo.h"
 #include "worldentities/pawns/Pawn.h"
@@ -119,6 +118,5 @@
                 this->teamsAlive--;
             const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
-            COUT(0) << message << std::endl;
-            Host::Broadcast(message);
+            ChatManager::message(message);
         }
         return allow;
Index: code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc	(revision 8858)
@@ -141,7 +141,7 @@
             return;
 
-        COUT(0) << "Points standing:" << std::endl << "Team 1: "<< pointsTeam1_ << std::endl << "Team 2: " << pointsTeam2_ << std::endl;
-        if(pointsTeam1_ >=1700 && pointsTeam1_ < 2000) COUT(0) << "Team 1 is near victory!" << std::endl;
-        if(pointsTeam2_ >=1700 && pointsTeam2_ < 2000) COUT(0) << "Team 2 is near victory!" << std::endl;
+        orxout(message) << "Points standing:" << '\n' << "Team 1: "<< pointsTeam1_ << '\n' << "Team 2: " << pointsTeam2_ << endl;
+        if(pointsTeam1_ >=1700 && pointsTeam1_ < 2000) orxout(message) << "Team 1 is near victory!" << endl;
+        if(pointsTeam2_ >=1700 && pointsTeam2_ < 2000) orxout(message) << "Team 2 is near victory!" << endl;
     }
 
@@ -179,10 +179,10 @@
             if (this->pointsTeam1_ > this->pointsTeam2_)
             {
-                COUT(0) << "Team 1 has won the match" << std::endl;
+                orxout(message) << "Team 1 has won the match" << endl;
                 winningteam = 0;
             }
             else
             {
-                COUT(0) << "Team 2 has won the match" << std::endl;
+                orxout(message) << "Team 2 has won the match" << endl;
                 winningteam = 1;
             }
Index: code/trunk/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/UnderAttack.cc	(revision 8857)
+++ code/trunk/src/orxonox/gametypes/UnderAttack.cc	(revision 8858)
@@ -32,5 +32,5 @@
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
-#include "network/Host.h"
+#include "chat/ChatManager.h"
 #include "worldentities/pawns/Destroyer.h"
 #include "infos/PlayerInfo.h"
@@ -70,6 +70,5 @@
         this->end(); //end gametype
         std::string message("Ship destroyed! Team 0 has won!");
-        COUT(0) << message << std::endl;
-        Host::Broadcast(message);
+        ChatManager::message(message);
         this->gameEnded_ = true;
 
@@ -153,6 +152,5 @@
                 this->end();
                 std::string message("Time is up! Team 1 has won!");
-                COUT(0) << message << std::endl;
-                Host::Broadcast(message);
+                ChatManager::message(message);
 
                 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
@@ -173,6 +171,5 @@
                 const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
 /*
-                COUT(0) << message << std::endl;
-                Host::Broadcast(message);
+                ChatManager::message(message);
 */
                 this->gtinfo_->sendAnnounceMessage(message);
Index: code/trunk/src/orxonox/graphics/AnimatedModel.cc
===================================================================
--- code/trunk/src/orxonox/graphics/AnimatedModel.cc	(revision 8857)
+++ code/trunk/src/orxonox/graphics/AnimatedModel.cc	(revision 8858)
@@ -22,5 +22,6 @@
  *   Author:
  *      Benjamin de Capitani
- *
+ *   Co-authors:
+ *      ...
  *
  */
Index: code/trunk/src/orxonox/graphics/AnimatedModel.h
===================================================================
--- code/trunk/src/orxonox/graphics/AnimatedModel.h	(revision 8857)
+++ code/trunk/src/orxonox/graphics/AnimatedModel.h	(revision 8858)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Benjamin de Capitani
  *   Co-authors:
  *      ...
Index: code/trunk/src/orxonox/graphics/CEGuiSample.cc
===================================================================
--- code/trunk/src/orxonox/graphics/CEGuiSample.cc	(revision 8857)
+++ 	(revision )
@@ -1,304 +1,0 @@
-/***********************************************************************
-    filename:   CEGuiSample.cpp
-    created:    24/9/2004
-    author:     Paul D Turner
-*************************************************************************/
-/***************************************************************************
- *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
- *
- *   Permission is hereby granted, free of charge, to any person obtaining
- *   a copy of this software and associated documentation files (the
- *   "Software"), to deal in the Software without restriction, including
- *   without limitation the rights to use, copy, modify, merge, publish,
- *   distribute, sublicense, and/or sell copies of the Software, and to
- *   permit persons to whom the Software is furnished to do so, subject to
- *   the following conditions:
- *
- *   The above copyright notice and this permission notice shall be
- *   included in all copies or substantial portions of the Software.
- *
- *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *   OTHER DEALINGS IN THE SOFTWARE.
- ***************************************************************************/
-#include "CEGuiSample.h"
-
-#ifdef HAVE_CONFIG_H
-#   include "config.h"
-#endif
-#include "CEGUISamplesConfig.h"
-
-// includes for renderer selector classes
-#if defined( __WIN32__ ) || defined( _WIN32 )
-#   include "Win32CEGuiRendererSelector.h"
-#elif defined(__linux__)
-#   ifdef CEGUI_SAMPLES_USE_GTK2
-#       include "GTK2CEGuiRendererSelector.h"
-#   else
-#       include "CLICEGuiRendererSelector.h"
-#   endif
-#elif defined(__APPLE__)
-#   include "MacCEGuiRendererSelector.h"
-#endif
-
-// includes for application types
-#ifdef CEGUI_SAMPLES_USE_OGRE
-#   include "CEGuiOgreBaseApplication.h"
-#endif
-#ifdef CEGUI_SAMPLES_USE_OPENGL
-#   include "CEGuiOpenGLBaseApplication.h"
-#endif
-#ifdef CEGUI_SAMPLES_USE_IRRLICHT
-#   include "CEGuiIrrlichtBaseApplication.h"
-#endif
-#ifdef CEGUI_SAMPLES_USE_DIRECTFB
-#   include "CEGuiDirectFBBaseApplication.h"
-#endif
-#if defined( __WIN32__ ) || defined( _WIN32 )
-#   ifdef CEGUI_SAMPLES_USE_DIRECTX_8
-#       include "CEGuiD3D81BaseApplication.h"
-#   endif
-#   ifdef CEGUI_SAMPLES_USE_DIRECTX_9
-#       include "CEGuiD3D9BaseApplication.h"
-#   endif
-#   ifdef CEGUI_SAMPLES_USE_DIRECTX_10
-#       include "CEGuiD3D10BaseApplication.h"
-#   endif
-#endif
-// now we include the base CEGuiBaseApplication just in case someone has managed to
-// get this far without any of the renderers.  This ensures the framework will build,
-// although there will be no renderers available for selection in the samples.
-#include "CEGuiBaseApplication.h"
-
-#include "CEGUI.h"
-
-#ifdef CEGUI_WITH_XERCES
-#   include "CEGUIXercesParser.h"
-#endif
-
-// Include iostream if not on windows.
-#if defined( __WIN32__ ) || defined( _WIN32 )
-#else
-#    include <iostream>
-#endif
-
-
-/*************************************************************************
-    Constructor
-*************************************************************************/
-CEGuiSample::CEGuiSample() :
-        d_rendererSelector(0),
-        d_sampleApp(0)
-{}
-
-
-/*************************************************************************
-    Destructor
-*************************************************************************/
-CEGuiSample::~CEGuiSample()
-{
-    if (d_sampleApp)
-    {
-        d_sampleApp->cleanup();
-        delete d_sampleApp;
-    }
-
-    if (d_rendererSelector)
-    {
-        delete d_rendererSelector;
-    }
-
-}
-
-
-/*************************************************************************
-    Application entry point
-*************************************************************************/
-int CEGuiSample::run()
-{
-    try
-    {
-        if (initialise())
-            cleanup();
-    }
-    catch (CEGUI::Exception& exc)
-    {
-        outputExceptionMessage(exc.getMessage().c_str());
-    }
-    catch (std::exception& exc)
-    {
-        outputExceptionMessage(exc.what());
-    }
-    catch(...)
-    {
-        outputExceptionMessage("Unknown exception was caught!");
-    }
-
-    return 0;
-}
-
-
-/*************************************************************************
-    Initialise the sample application
-*************************************************************************/
-bool CEGuiSample::initialise()
-{
-    // Setup renderer selection dialog for Win32
-#if defined( __WIN32__ ) || defined( _WIN32 )
-    d_rendererSelector = new Win32CEGuiRendererSelector;
-
-    // enable renderer types supported for Win32
-#ifdef CEGUI_SAMPLES_USE_DIRECTX_8
-    d_rendererSelector->setRendererAvailability(Direct3D81GuiRendererType);
-#endif
-#ifdef CEGUI_SAMPLES_USE_DIRECTX_9
-    d_rendererSelector->setRendererAvailability(Direct3D9GuiRendererType);
-#endif
-#ifdef CEGUI_SAMPLES_USE_DIRECTX_10
-    d_rendererSelector->setRendererAvailability(Direct3D10GuiRendererType);
-#endif
-
-#elif defined(__linux__)
-    // decide which method to use for renderer selection
-#   ifdef CEGUI_SAMPLES_USE_GTK2
-        d_rendererSelector = new GTK2CEGuiRendererSelector();
-#   else
-        d_rendererSelector = new CLICEGuiRendererSelector();
-#   endif
-
-#elif defined(__APPLE__)
-     d_rendererSelector = new MacCEGuiRendererSelector();
-#endif
-
-    // enable available renderer types
-#ifdef CEGUI_SAMPLES_USE_OGRE
-    d_rendererSelector->setRendererAvailability(OgreGuiRendererType);
-#endif
-#ifdef CEGUI_SAMPLES_USE_OPENGL
-    d_rendererSelector->setRendererAvailability(OpenGLGuiRendererType);
-#endif
-#ifdef CEGUI_SAMPLES_USE_IRRLICHT
-    d_rendererSelector->setRendererAvailability(IrrlichtGuiRendererType);
-#endif
-#ifdef CEGUI_SAMPLES_USE_DIRECTFB
-    d_rendererSelector->setRendererAvailability(DirectFBGuiRendererType);
-#endif
-
-    // get selection from user
-    if (d_rendererSelector->invokeDialog())
-    {
-        // create appropriate application type based upon users selection
-        switch(d_rendererSelector->getSelectedRendererType())
-        {
-#ifdef CEGUI_SAMPLES_USE_OGRE
-        case OgreGuiRendererType:
-            d_sampleApp = new CEGuiOgreBaseApplication();
-            break;
-#endif
-#if defined( __WIN32__ ) || defined( _WIN32 )
-#ifdef CEGUI_SAMPLES_USE_DIRECTX_8
-        case Direct3D81GuiRendererType:
-            d_sampleApp = new CEGuiD3D81BaseApplication();
-            break;
-#endif
-#ifdef CEGUI_SAMPLES_USE_DIRECTX_9
-        case Direct3D9GuiRendererType:
-            d_sampleApp = new CEGuiD3D9BaseApplication();
-            break;
-#endif // DX9
-#ifdef CEGUI_SAMPLES_USE_DIRECTX_10
-        case Direct3D10GuiRendererType:
-            d_sampleApp = new CEGuiD3D10BaseApplication();
-            break;
-#endif // DX10
-#endif // Win32
-#ifdef CEGUI_SAMPLES_USE_OPENGL
-        case OpenGLGuiRendererType:
-            d_sampleApp = new CEGuiOpenGLBaseApplication();
-            break;
-#endif
-#ifdef CEGUI_SAMPLES_USE_IRRLICHT
-        case IrrlichtGuiRendererType:
-            d_sampleApp = new CEGuiIrrlichtBaseApplication();
-            break;
-#endif
-#ifdef CEGUI_SAMPLES_USE_DIRECTFB
-        case DirectFBGuiRendererType:
-            d_sampleApp = new CEGuiDirectFBBaseApplication();
-            break;
-#endif
-
-        default:
-            throw CEGUI::GenericException("No renderer was selected!");
-            break;
-        }
-
-        // set the default resource groups to be used
-        CEGUI::Imageset::setDefaultResourceGroup("imagesets");
-        CEGUI::Font::setDefaultResourceGroup("fonts");
-        CEGUI::Scheme::setDefaultResourceGroup("schemes");
-        CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
-        CEGUI::WindowManager::setDefaultResourceGroup("layouts");
-        CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
-#ifdef CEGUI_WITH_XERCES
-        CEGUI::XercesParser::setSchemaDefaultResourceGroup("schemas");
-#endif
-
-        // execute the base application (which sets up the demo via 'this' and runs it.
-        if (d_sampleApp->execute(this))
-        {
-            // signal that app initialised and ran
-            return true;
-        }
-
-        // sample app did not initialise, delete the object.
-        delete d_sampleApp;
-        d_sampleApp = 0;
-    }
-
-    // delete renderer selector object
-    delete d_rendererSelector;
-    d_rendererSelector = 0;
-
-    // signal app did not initialise and run.
-    return false;
-}
-
-
-/*************************************************************************
-    Cleanup the sample application.
-*************************************************************************/
-void CEGuiSample::cleanup()
-{
-    if (d_sampleApp)
-    {
-        d_sampleApp->cleanup();
-        delete d_sampleApp;
-        d_sampleApp = 0;
-    }
-
-    if (d_rendererSelector)
-    {
-        delete d_rendererSelector;
-        d_rendererSelector = 0;
-    }
-
-}
-
-
-/*************************************************************************
-    Output a message to the user in some OS independant way.
-*************************************************************************/
-void CEGuiSample::outputExceptionMessage(const char* message) const
-{
-#if defined(__WIN32__) || defined(_WIN32)
-    MessageBoxA(0, message, "CEGUI - Exception", MB_OK|MB_ICONERROR);
-#else
-    std::cout << "An exception was thrown within the sample framework:" << std::endl;
-    std::cout << message << std::endl;
-#endif
-}
Index: code/trunk/src/orxonox/graphics/CEGuiSample.h
===================================================================
--- code/trunk/src/orxonox/graphics/CEGuiSample.h	(revision 8857)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/***********************************************************************
-    filename:   CEGuiSample.h
-    created:    24/9/2004
-    author:     Paul D Turner
-*************************************************************************/
-/***************************************************************************
- *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
- *
- *   Permission is hereby granted, free of charge, to any person obtaining
- *   a copy of this software and associated documentation files (the
- *   "Software"), to deal in the Software without restriction, including
- *   without limitation the rights to use, copy, modify, merge, publish,
- *   distribute, sublicense, and/or sell copies of the Software, and to
- *   permit persons to whom the Software is furnished to do so, subject to
- *   the following conditions:
- *
- *   The above copyright notice and this permission notice shall be
- *   included in all copies or substantial portions of the Software.
- *
- *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- *   OTHER DEALINGS IN THE SOFTWARE.
- ***************************************************************************/
-#ifndef _CEGuiSample_h_
-#define _CEGuiSample_h_
-
-#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined (CEGUI_STATIC)
-#   ifdef CEGUISAMPLE_EXPORTS
-#       define CEGUISAMPLE_API __declspec(dllexport)
-#   else
-#       define CEGUISAMPLE_API __declspec(dllimport)
-#   endif
-#else
-#       define CEGUISAMPLE_API
-#endif
-
-
-// forward declarations
-class CEGuiBaseApplication;
-class CEGuiRendererSelector;
-
-
-/*!
-\brief
-    This is a base class that is intended to be used for all sample applications.
-    Here we take care of common things such the renderer selection and application
-    startup.
-*/
-class CEGUISAMPLE_API CEGuiSample
-{
-public:
-    /*!
-    \brief
-        Constructor.
-    */
-    CEGuiSample();
-
-
-    /*!
-    \brief
-        Destructor.
-    */
-    virtual ~CEGuiSample();
-
-
-    /*!
-    \brief
-        Application entry point.
-
-    \return
-        code to be returned by the application.
-    */
-    int run();
-
-
-    /*!
-    \brief
-        Sample specific initialisation goes here.  This method is called by the application base object created
-        as part of the initialise call.
-
-    \return
-        false if something went wrong.
-    */
-    virtual bool initialiseSample()  = 0;
-
-
-    /*!
-    \brief
-        Cleans up resources allocated in the initialiseSample call.
-    */
-    virtual void cleanupSample() = 0;
-
-
-protected:
-    /*!
-    \brief
-        Initialises the sample system, this includes asking the user for a render to use and
-        the subsequent creation of the required systems to support that renderer.
-
-    \return
-        false if anything went wrong.
-    */
-    virtual bool initialise();
-
-
-    /*!
-    \brief
-        Cleans up all resources allocated by the initialise call.
-    */
-    virtual void cleanup();
-
-
-    /*!
-    \brief
-        Output a message to the user in some OS independant way.
-    */
-    void outputExceptionMessage(const char* message) const;
-
-    /*************************************************************************
-        Data fields
-    *************************************************************************/
-    CEGuiRendererSelector*  d_rendererSelector;     //!< Points to the renderer selector object.
-    CEGuiBaseApplication*   d_sampleApp;            //!< Pointer to the base application object.
-};
-
-#endif  // end of guard _CEGuiSample_h_
Index: code/trunk/src/orxonox/graphics/Model.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Model.cc	(revision 8857)
+++ code/trunk/src/orxonox/graphics/Model.cc	(revision 8858)
@@ -142,5 +142,5 @@
             if( this->numLodLevels_>10 )
             {
-                CCOUT(2) << "More than 10 LoD levels requested. Creating only 10." << endl;
+                orxout(internal_warning, context::lod) << "More than 10 LoD levels requested. Creating only 10." << endl;
                 this->numLodLevels_ = 10;
             }
@@ -158,7 +158,7 @@
                     creatorPtr = creatorPtr->getCreator();
                 }
-                COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
+                orxout() << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
 */
-                COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl;
+                orxout(verbose, context::lod) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << endl;
 
 #if OGRE_VERSION >= 0x010700
@@ -173,5 +173,5 @@
                     float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_;
 
-                    COUT(4) << "LodLevel set with factor: " << factor << endl;
+                    orxout(verbose, context::lod) << "LodLevel set with factor: " << factor << endl;
 
                     distList.push_back(70.0f*factor);
@@ -200,9 +200,9 @@
                         what = "<0";
 
-                    COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl;
+                    orxout(verbose, context::lod) << "LodLevel not set because lodLevel(" << lodLevel_ << ") was " << what << "." << endl;
                 }
             }
             else
-                COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
+                orxout(verbose, context::lod) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
         }
     }
Index: code/trunk/src/orxonox/graphics/ParticleEmitter.cc
===================================================================
--- code/trunk/src/orxonox/graphics/ParticleEmitter.cc	(revision 8857)
+++ code/trunk/src/orxonox/graphics/ParticleEmitter.cc	(revision 8858)
@@ -116,6 +116,6 @@
             catch (const std::exception& ex)
             {
-                COUT(1) << "Error: Couln't load particle effect \"" << this->source_ << "\" because:" << std::endl
-                        << ex.what() << std::endl;
+                orxout(internal_error) << "Couldn't load particle effect \"" << this->source_ << "\" because:" << endl
+                                       << ex.what() << endl;
             }
         }
Index: code/trunk/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.cc	(revision 8857)
+++ code/trunk/src/orxonox/infos/GametypeInfo.cc	(revision 8858)
@@ -196,5 +196,5 @@
         this->startCountdown_ = countdown;
         // Set the counter to the ceiling of the current countdown.
-        this->counter_ = std::ceil(countdown);
+        this->counter_ = static_cast<unsigned int>(std::ceil(countdown));
         this->changedCountdownCounter();
     }
Index: code/trunk/src/orxonox/interfaces/PickupCarrier.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupCarrier.cc	(revision 8857)
+++ code/trunk/src/orxonox/interfaces/PickupCarrier.cc	(revision 8858)
@@ -75,5 +75,5 @@
             if(it != this->pickups_.end() && temp == *it) // Infinite loop avoidance, in case the pickup wasn't removed from the carrier somewhere in the carrierDestroy() procedure.
             {
-                COUT(2) << "Oops. In a PickupCarrier, while cleaning up, a Pickupable (&" << temp << ") didn't unregister itself as it should have." << std::endl;;
+                orxout(internal_warning, context::pickups) << "Oops. In a PickupCarrier, while cleaning up, a Pickupable (&" << temp << ") didn't unregister itself as it should have." << endl;;
                 it++;
             }
@@ -158,5 +158,5 @@
     bool PickupCarrier::addPickup(Pickupable* pickup)
     {
-        COUT(4) << "Adding Pickupable (&" << pickup << ") to PickupCarrier (&" << this << ")" << std::endl;
+        orxout(verbose, context::pickups) << "Adding Pickupable (&" << pickup << ") to PickupCarrier (&" << this << ")" << endl;
         return this->pickups_.insert(pickup).second;
     }
@@ -172,5 +172,5 @@
     bool PickupCarrier::removePickup(Pickupable* pickup)
     {
-        COUT(4) << "Removing Pickupable (&" << pickup << ") from PickupCarrier (&" << this << ")" << std::endl;
+        orxout(verbose, context::pickups) << "Removing Pickupable (&" << pickup << ") from PickupCarrier (&" << this << ")" << endl;
         return this->pickups_.erase(pickup) == 1;
     }
Index: code/trunk/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.cc	(revision 8857)
+++ code/trunk/src/orxonox/interfaces/Pickupable.cc	(revision 8858)
@@ -71,5 +71,5 @@
         if(this->pickupIdentifier_ != NULL)
         {
-            COUT(4) << "Pickupable (&" << this << ") destroyed." << std::endl;
+            orxout(verbose, context::pickups) << "Pickupable (&" << this << ") destroyed." << endl;
             this->pickupIdentifier_->destroy();
         }
@@ -107,5 +107,5 @@
             this->OrxonoxClass::destroy();
         else
-            COUT(2) << this->getIdentifier()->getName() << " may be unsafe. " << std::endl;
+            orxout(internal_warning, context::pickups) << this->getIdentifier()->getName() << " may be unsafe. " << endl;
     }
 
@@ -126,5 +126,5 @@
             return false;
 
-        COUT(4) << "Pickupable (&" << this << ") set to used " << used << "." << std::endl;
+        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") set to used " << used << "." << endl;
 
         this->used_ = used;
@@ -201,5 +201,5 @@
             return false;
 
-        COUT(4) << "Target " << target->getName() << " added to Pickupable (" << this->getIdentifier()->getName() << ") (&" << this << ")." << std::endl;
+        orxout(verbose, context::pickups) << "Target " << target->getName() << " added to Pickupable (" << this->getIdentifier()->getName() << ") (&" << this << ")." << endl;
         this->targets_.push_back(target);
         return true;
@@ -221,10 +221,10 @@
         if(!this->setCarrier(carrier))
         {
-            COUT(3) << "A Pickupable (&" << this << ") was trying to be added to a PickupCarrier, but was already present." << std::endl;
+            orxout(internal_warning, context::pickups) << "A Pickupable (&" << this << ") was trying to be added to a PickupCarrier, but was already present." << endl;
             return false;
         }
 
         this->setPickedUp(true);
-        COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl;
+        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << endl;
         return true;
     }
@@ -245,7 +245,7 @@
         assert(this->getCarrier()); // The Carrier cannot be NULL at this point.
         if(!this->getCarrier()->removePickup(this)) //TODO Shouldn't this be a little later?
-            COUT(2) << "Pickupable (&" << this << ", " << this->getIdentifier()->getName() << ") is being dropped, but it was not present in the PickupCarriers list of pickups." << std::endl;
-
-        COUT(4) << "Pickupable (&" << this << ") got dropped up by a PickupCarrier (&" << this->getCarrier() << ")." << std::endl;
+            orxout(internal_warning, context::pickups) << "Pickupable (&" << this << ", " << this->getIdentifier()->getName() << ") is being dropped, but it was not present in the PickupCarriers list of pickups." << endl;
+
+        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") got dropped up by a PickupCarrier (&" << this->getCarrier() << ")." << endl;
         this->setUsed(false);
         this->setPickedUp(false);
@@ -276,5 +276,5 @@
             return false;
 
-        COUT(4) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << std::endl;
+        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << endl;
 
         this->pickedUp_ = pickedUp;
@@ -305,5 +305,5 @@
             return false;
 
-        COUT(4) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << std::endl;
+        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << endl;
 
         if(carrier != NULL && tell)
@@ -340,5 +340,5 @@
         Pickupable* pickup = dynamic_cast<Pickupable*>(item);
 
-        COUT(4) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << std::endl;
+        orxout(verbose, context::pickups) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << endl;
         return pickup;
     }
Index: code/trunk/src/orxonox/interfaces/RadarViewable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/RadarViewable.cc	(revision 8857)
+++ code/trunk/src/orxonox/interfaces/RadarViewable.cc	(revision 8858)
@@ -83,5 +83,5 @@
 //         else
 //         {
-//             CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;
+//             orxout(internal_warning) << "Attempting to access the radar, but the radar is non existent." << endl;
 //         }
 //         this->radarObjectDescription_ = str;
@@ -106,5 +106,5 @@
         if (!object)
         {
-            COUT(1) << "Assertion: Every RadarViewable has to be assigned a WorldEntity pointer!" << std::endl;
+            orxout(user_error) << "Assertion: Every RadarViewable has to be assigned a WorldEntity pointer!" << endl;
             assert(0);
         }
Index: code/trunk/src/orxonox/items/Engine.cc
===================================================================
--- code/trunk/src/orxonox/items/Engine.cc	(revision 8857)
+++ code/trunk/src/orxonox/items/Engine.cc	(revision 8858)
@@ -261,5 +261,5 @@
         if(!this->engineTemplate_.empty())
         {
-            COUT(4)<<"Loading an engine template: "<<this->engineTemplate_<<"\n";
+            orxout(verbose, context::templates) << "Loading an engine template: " << this->engineTemplate_ << endl;
             Template *temp = Template::getTemplate(this->engineTemplate_);
             if(temp)
Index: code/trunk/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/InGameConsole.cc	(revision 8857)
+++ code/trunk/src/orxonox/overlays/InGameConsole.cc	(revision 8858)
@@ -46,4 +46,5 @@
 #include "util/DisplayStringConversions.h"
 #include "util/ScopedSingletonManager.h"
+#include "util/output/MemoryWriter.h"
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
@@ -58,5 +59,5 @@
 {
     const int LINES = 30;
-    const float CHAR_WIDTH = 7.45f; // fix this please - determine the char-width dynamically
+    const float CHAR_WIDTH = 8.0f; // fix this please - determine the char-width dynamically
 
     SetConsoleCommand("InGameConsole", "openConsole", &InGameConsole::openConsole);
@@ -94,5 +95,5 @@
         // Output buffering is not anymore needed. Not the best solution to do
         // this here, but there isn't much of another way.
-        OutputHandler::getInstance().disableMemoryLog();
+        MemoryWriter::getInstance().disable();
     }
 
@@ -262,5 +263,5 @@
         this->consoleOverlayContainer_->setTop(-1.3f * this->relativeHeight);
 
-        COUT(4) << "Info: InGameConsole initialized" << std::endl;
+        orxout(internal_info) << "InGameConsole initialized" << endl;
     }
 
@@ -288,5 +289,5 @@
 
         for (int i = LINES - 1; i > max; --i)
-            this->print("", Shell::None, i, true);
+            this->print("", Shell::DebugOutput, i, true);
 
         for (int i = max; i >= 1; --i)
@@ -298,20 +299,12 @@
 
     /**
-        @brief Called if only the last output-line has changed.
-    */
-    void InGameConsole::onlyLastLineChanged()
-    {
+        @brief Called if a new output-line was added.
+    */
+    void InGameConsole::lineAdded()
+    {
+        this->numLinesShifted_ = 0;
+        this->shiftLines();
         if (LINES > 1)
             this->print(this->shell_->getNewestLineIterator()->first, this->shell_->getNewestLineIterator()->second, 1);
-    }
-
-    /**
-        @brief Called if a new output-line was added.
-    */
-    void InGameConsole::lineAdded()
-    {
-        this->numLinesShifted_ = 0;
-        this->shiftLines();
-        this->onlyLastLineChanged();
     }
 
@@ -346,5 +339,5 @@
     void InGameConsole::executed()
     {
-        this->shell_->addOutput(this->shell_->getInput() + '\n', Shell::Command);
+        this->shell_->addOutput(this->shell_->getInput(), Shell::Command);
     }
 
@@ -437,5 +430,5 @@
 
         // now adjust the text lines...
-        this->desiredTextWidth_ = static_cast<int>(this->windowW_ * this->relativeWidth) - 12;
+        this->desiredTextWidth_ = static_cast<int>(this->windowW_ * this->relativeWidth) - 24;
 
         if (LINES > 0)
@@ -566,34 +559,29 @@
         switch (type)
         {
-        case Shell::Error:   colourTop = ColourValue(0.95f, 0.25f, 0.25f, 1.00f);
-                          colourBottom = ColourValue(1.00f, 0.50f, 0.50f, 1.00f); break;
-
-        case Shell::Warning: colourTop = ColourValue(0.95f, 0.50f, 0.20f, 1.00f);
-                          colourBottom = ColourValue(1.00f, 0.70f, 0.50f, 1.00f); break;
-
-        case Shell::Info:    colourTop = ColourValue(0.50f, 0.50f, 0.95f, 1.00f);
-                          colourBottom = ColourValue(0.80f, 0.80f, 1.00f, 1.00f); break;
-
-        case Shell::Debug:   colourTop = ColourValue(0.65f, 0.48f, 0.44f, 1.00f);
-                          colourBottom = ColourValue(1.00f, 0.90f, 0.90f, 1.00f); break;
-
-        case Shell::Verbose: colourTop = ColourValue(0.40f, 0.20f, 0.40f, 1.00f);
-                          colourBottom = ColourValue(0.80f, 0.60f, 0.80f, 1.00f); break;
-
-        case Shell::Ultra:   colourTop = ColourValue(0.21f, 0.69f, 0.21f, 1.00f);
-                          colourBottom = ColourValue(0.80f, 1.00f, 0.80f, 1.00f); break;
-
-        case Shell::Command: colourTop = ColourValue(0.80f, 0.80f, 0.80f, 1.00f);
-                          colourBottom = ColourValue(0.90f, 0.90f, 0.90f, 0.90f); break;
-
-        case Shell::Hint:    colourTop = ColourValue(0.80f, 0.80f, 0.80f, 1.00f);
-                          colourBottom = ColourValue(0.90f, 0.90f, 0.90f, 1.00f); break;
-
-        case Shell::TDebug:  colourTop = ColourValue(0.90f, 0.00f, 0.90f, 1.00f);
-                          colourBottom = ColourValue(1.00f, 0.00f, 1.00f, 1.00f); break;
-
-        default:             colourTop = ColourValue(0.90f, 0.90f, 0.90f, 1.00f);
-                          colourBottom = ColourValue(1.00f, 1.00f, 1.00f, 1.00f); break;
-        }
+            case Shell::Message:
+            case Shell::DebugOutput:     colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
+
+            case Shell::UserError:       colourTop = ColourValue(0.9f, 0.0f, 0.0f); break;
+            case Shell::UserWarning:     colourTop = ColourValue(0.9f, 0.5f, 0.0f); break;
+            case Shell::UserStatus:      colourTop = ColourValue(0.0f, 0.9f, 0.0f); break;
+            case Shell::UserInfo:        colourTop = ColourValue(0.0f, 0.8f, 0.8f); break;
+
+            case Shell::InternalError:   colourTop = ColourValue(0.5f, 0.0f, 0.0f); break;
+            case Shell::InternalWarning: colourTop = ColourValue(0.5f, 0.2f, 0.0f); break;
+            case Shell::InternalStatus:  colourTop = ColourValue(0.0f, 0.5f, 0.0f); break;
+            case Shell::InternalInfo:    colourTop = ColourValue(0.0f, 0.4f, 0.4f); break;
+
+            case Shell::Verbose:         colourTop = ColourValue(0.3f, 0.3f, 0.9f); break;
+            case Shell::VerboseMore:     colourTop = ColourValue(0.2f, 0.2f, 0.7f); break;
+            case Shell::VerboseUltra:    colourTop = ColourValue(0.1f, 0.1f, 0.5f); break;
+
+            case Shell::Command:         colourTop = ColourValue(0.8f, 0.2f, 0.8f); break;
+            case Shell::Hint:            colourTop = ColourValue(0.4f, 0.0f, 0.4f); break;
+            case Shell::Input:           colourTop = ColourValue(0.9f, 0.9f, 0.9f); break;
+
+            default:                     colourTop = ColourValue(0.5f, 0.5f, 0.5f); break;
+        }
+
+        colourBottom = ColourValue(sqrt(colourTop.r), sqrt(colourTop.g), sqrt(colourTop.b));
 
         this->consoleOverlayTextAreas_[index]->setColourTop   (colourTop);
Index: code/trunk/src/orxonox/overlays/InGameConsole.h
===================================================================
--- code/trunk/src/orxonox/overlays/InGameConsole.h	(revision 8857)
+++ code/trunk/src/orxonox/overlays/InGameConsole.h	(revision 8858)
@@ -64,5 +64,4 @@
 
         void linesChanged();
-        void onlyLastLineChanged();
         void lineAdded();
         void inputChanged();
Index: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 8857)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 8858)
@@ -147,5 +147,5 @@
 
         if (OrxonoxOverlay::overlays_s.find(this->getName()) != OrxonoxOverlay::overlays_s.end())
-            COUT(1) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << '"' << std::endl;
+            orxout(internal_warning) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << '"' << endl;
 
         OrxonoxOverlay::overlays_s[this->getName()] = this;
@@ -362,10 +362,10 @@
             {
                 overlay->hide();
-                COUT(4) << "HIDE " << name << std::endl;
+                orxout(verbose, context::misc::overlays) << "HIDE " << name << endl;
             }
             else
             {
                 overlay->show();
-                COUT(4) << "SHOW " << name << std::endl;
+                orxout(verbose, context::misc::overlays) << "SHOW " << name << endl;
             }
         }
Index: code/trunk/src/orxonox/pickup/PickupIdentifier.cc
===================================================================
--- code/trunk/src/orxonox/pickup/PickupIdentifier.cc	(revision 8857)
+++ code/trunk/src/orxonox/pickup/PickupIdentifier.cc	(revision 8858)
@@ -51,5 +51,5 @@
 
         if(pickup == NULL)
-            COUT(1) << "Error, PickupIdentifier was created without a valid Pickupable." << std::endl;
+            orxout(internal_error, context::pickups) << "PickupIdentifier was created without a valid Pickupable." << endl;
 
         this->pickup_ = pickup;
@@ -83,5 +83,5 @@
         if(!(this->parameters_.size() == identifier->parameters_.size()))
         {
-            COUT(1) << "Something went wrong in PickupIdentifier!" << std::endl;
+            orxout(internal_error, context::pickups) << "Something went wrong in PickupIdentifier!" << endl;
             return this->parameters_.size()-identifier->parameters_.size();
         }
@@ -93,5 +93,5 @@
             if(identifier->parameters_.find(it->first) == identifier->parameters_.end())
             {
-                COUT(1) << "Something went wrong in PickupIdentifier!" << std::endl;
+                orxout(internal_error, context::pickups) << "Something went wrong in PickupIdentifier!" << endl;
                 return -1;
             }
@@ -115,9 +115,9 @@
     bool PickupIdentifier::addParameter(std::string & name, std::string & value)
     {
-        COUT(4) << "PickupIdentifier " << name << ", " << value << std::endl;
+        orxout(verbose, context::pickups) << "PickupIdentifier " << name << ", " << value << endl;
 
         if(!(this->parameters_.find(name) == this->parameters_.end()))
         {
-            COUT(4) << "Request for adding a parameter that already exists for the PickupIdentififer was denied. name: '" << name << "', value: '" << value << "'."<<  std::endl;
+            orxout(verbose, context::pickups) << "Request for adding a parameter that already exists for the PickupIdentififer was denied. name: '" << name << "', value: '" << value << "'."<<  endl;
             return false;
         }
Index: code/trunk/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/AmbientSound.cc	(revision 8857)
+++ code/trunk/src/orxonox/sound/AmbientSound.cc	(revision 8858)
@@ -94,5 +94,5 @@
                 this->setSource(path);
             else
-                COUT(3) << "Sound: " << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << std::endl;
+                orxout(internal_warning, context::sound) << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << endl;
         }
     }
Index: code/trunk/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/BaseSound.cc	(revision 8857)
+++ code/trunk/src/orxonox/sound/BaseSound.cc	(revision 8858)
@@ -94,5 +94,5 @@
             alSourcePlay(this->audioSource_);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error playing sound: " << SoundManager::getALErrorString(error) << std::endl;
+                orxout(internal_error, context::sound) << "Error playing sound: " << SoundManager::getALErrorString(error) << endl;
         }
     }
@@ -147,10 +147,10 @@
         alSource3f(this->audioSource_, AL_DIRECTION, 0, 0, 0);
         if (ALint error = alGetError())
-            COUT(2) << "Sound Warning: Setting source parameters to 0 failed: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+            orxout(internal_warning, context::sound) << "Setting source parameters to 0 failed: "
+                                                     << SoundManager::getALErrorString(error) << endl;
         assert(this->soundBuffer_ != NULL);
         alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
         if (ALuint error = alGetError())
-            COUT(1) << "Sound Error: Could not set buffer \"" << this->source_ << "\": " << SoundManager::getALErrorString(error) << std::endl;
+            orxout(internal_error, context::sound) << "Could not set buffer \"" << this->source_ << "\": " << SoundManager::getALErrorString(error) << endl;
     }
 
@@ -159,5 +159,5 @@
         this->volume_ = clamp(vol, 0.0f, 1.0f);
         if (this->volume_ != vol)
-            COUT(2) << "Sound warning: volume out of range, clamping value." << std::endl;
+            orxout(internal_warning, context::sound) << "Volume out of range, clamping value." << endl;
         this->updateVolume();
     }
@@ -170,6 +170,6 @@
             alSourcef(this->audioSource_, AL_GAIN, volume);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error setting volume to " << volume
-                        << ": " << SoundManager::getALErrorString(error) << std::endl;
+                orxout(internal_error, context::sound) << "Error setting volume to " << volume
+                                                       << ": " << SoundManager::getALErrorString(error) << endl;
         }
     }
@@ -186,5 +186,5 @@
         if (pitch > 2 || pitch < 0.5f)
         {
-            COUT(2) << "Sound warning: pitch out of range, cropping value." << std::endl;
+            orxout(internal_warning, context::sound) << "Pitch out of range, cropping value." << endl;
             pitch = pitch > 2.0f ? 2.0f : pitch;
             pitch = pitch < 0.5f ? 0.5f : pitch;
@@ -195,5 +195,5 @@
             alSourcef(this->audioSource_, AL_PITCH, pitch);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error setting pitch: " << SoundManager::getALErrorString(error) << std::endl;
+                orxout(internal_error, context::sound) << "Error setting pitch: " << SoundManager::getALErrorString(error) << endl;
         }
     }
@@ -240,5 +240,5 @@
             if (ALuint error = alGetError())
             {
-                COUT(1) << "Sound Error: Could not set buffer \"" << source << "\": " << SoundManager::getALErrorString(error) << std::endl;
+                orxout(internal_error, context::sound) << "Could not set buffer \"" << source << "\": " << SoundManager::getALErrorString(error) << endl;
                 return;
             }
@@ -248,5 +248,5 @@
             alSourcePlay(this->audioSource_);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error playing sound: " << SoundManager::getALErrorString(error) << std::endl;
+                orxout(internal_error, context::sound) << "Error playing sound: " << SoundManager::getALErrorString(error) << endl;
             if (this->isPaused())
                 alSourcePause(this->audioSource_);
Index: code/trunk/src/orxonox/sound/SoundBuffer.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundBuffer.cc	(revision 8857)
+++ code/trunk/src/orxonox/sound/SoundBuffer.cc	(revision 8858)
@@ -51,5 +51,5 @@
         if (fileInfo == NULL)
         {
-            COUT(2) << "Sound: Warning: Sound file '" << filename << "' not found" << std::endl;
+            orxout(internal_error, context::sound) << "Sound file '" << filename << "' not found" << endl;
             return;
         }
@@ -144,5 +144,5 @@
         if (ret < 0)
         {
-            COUT(2) << "Sound: libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << std::endl;
+            orxout(internal_error, context::sound) << "libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << endl;
             ov_clear(&vf);
             ThrowException(General, "Sound Error: Ogg file loader failed when opening the bitstream");
@@ -160,5 +160,5 @@
             else if (ret < 0)
             {
-                COUT(2) << "Sound: libvorbisfile: error reading the file" << std::endl;
+                orxout(internal_error, context::sound) << "libvorbisfile: error reading the file" << endl;
                 ov_clear(&vf);
                 ThrowException(General, "Sound Error: Ogg file loader failed when decoding the file");
Index: code/trunk/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.cc	(revision 8857)
+++ code/trunk/src/orxonox/sound/SoundManager.cc	(revision 8858)
@@ -71,4 +71,6 @@
         RegisterRootObject(SoundManager);
 
+        orxout(user_status) << "Loading sound" << endl;
+
         this->bDestructorCalled_ = false;
          
@@ -89,17 +91,17 @@
         std::string renderDevice;
         SetConfigValue(renderDevice, std::string(device)).description("Sound device used for rendering");
-        COUT(4) << "Sound: Available devices: ";
+        orxout(verbose, context::sound) << "Sound: Available devices: ";
         while (true)
         {
             this->deviceNames_.push_back(devices);
-            COUT(4) << '"' << devices << "\", ";
+            orxout(verbose, context::sound) << '"' << devices << "\", ";
             devices += strlen(devices) + 1;
             if (*devices == '\0')
                 break;
         }
-        COUT(4) << std::endl;
+        orxout(verbose, context::sound) << endl;
 
         // Open the selected device
-        COUT(3) << "Sound: Opening device \"" << renderDevice << '\' << std::endl;
+        orxout(internal_info, context::sound) << "Sound: Opening device \"" << renderDevice << '\' << endl;
         this->device_ = alcOpenDevice(renderDevice.c_str());
 */
@@ -122,11 +124,11 @@
         // Get some information about the sound
         if (const char* version = alGetString(AL_VERSION))
-            COUT(4) << "Sound: --- OpenAL Version: " << version << std::endl;
+            orxout(internal_info, context::sound) << "Sound: --- OpenAL Version: " << version << endl;
         if (const char* vendor = alGetString(AL_VENDOR))
-            COUT(4) << "Sound: --- OpenAL Vendor : " << vendor << std::endl;
+            orxout(internal_info, context::sound) << "Sound: --- OpenAL Vendor : " << vendor << endl;
         if (const char* types = alutGetMIMETypes(ALUT_LOADER_BUFFER))
-            COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl;
+            orxout(internal_info, context::sound) << "Sound: --- Supported MIME Types: " << types << endl;
         else
-            COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;
+            orxout(internal_warning, context::sound) << "MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << endl;
 
         this->mute_[SoundType::All]     = 1.0f;
@@ -152,5 +154,5 @@
         resetPlaysSoundGuard.Dismiss();
 
-        COUT(4) << "Sound: Initialisation complete" << std::endl;
+        orxout(internal_status, context::sound) << "Sound: Initialisation complete" << endl;
     }
 
@@ -164,5 +166,5 @@
         // If there are still used buffers around, well, that's just very bad...
         if (this->soundBuffers_.size() != this->effectsPool_.size())
-            COUT(1) << "Sound Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
+            orxout(internal_error, context::sound) << "Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << endl;
         // Empty buffer pool and buffer list
         this->effectsPool_.clear();
@@ -171,5 +173,5 @@
         // There should not be any sources in use anymore
         if (!this->usedSoundSources_.empty())
-            COUT(1) << "Sound Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
+            orxout(internal_error, context::sound) << "Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << endl;
         while (!this->availableSoundSources_.empty())
         {
@@ -182,21 +184,21 @@
         // Relieve context to destroy it
         if (!alcMakeContextCurrent(NULL))
-            COUT(1) << "Sound Error: Could not unset ALC context" << std::endl;
+            orxout(internal_error, context::sound) << "Could not unset ALC context" << endl;
         alcDestroyContext(this->context_);
         if (ALCenum error = alcGetError(this->device_))
         {
             if (error == AL_INVALID_OPERATION)
-                COUT(1) << "Sound Error: Could not destroy ALC context because it is the current one" << std::endl;
+                orxout(internal_error, context::sound) << "Could not destroy ALC context because it is the current one" << endl;
             else
-                COUT(1) << "Sound Error: Could not destroy ALC context because it is invalid" << std::endl;
+                orxout(internal_error, context::sound) << "Could not destroy ALC context because it is invalid" << endl;
         }
 #ifdef AL_VERSION_1_1
         if (!alcCloseDevice(this->device_))
-            COUT(1) << "Sound Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;
+            orxout(internal_error, context::sound) << "Could not destroy ALC device. This might be because there are still buffers in use!" << endl;
 #else
         alcCloseDevice(this->device_);
 #endif
         if (!alutExit())
-            COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;
+            orxout(internal_error, context::sound) << "Closing ALUT failed: " << alutGetErrorString(alutGetError()) << endl;
     }
 
@@ -244,5 +246,5 @@
         if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 )
         {
-            COUT(2) << "Sound warning: fade step out of range, ignoring change." << std::endl;
+            orxout(internal_warning, context::sound) << "Fade step out of range, ignoring change." << endl;
             ResetConfigValue(crossFadeStep_);
         }
@@ -253,5 +255,5 @@
         float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f);
         if (clampedVolume != this->volume_[type])
-            COUT(2) << "Sound warning: Volume setting (" << type << ") out of range, clamping." << std::endl;
+            orxout(internal_warning, context::sound) << "Volume setting (" << type << ") out of range, clamping." << endl;
         this->updateVolume(type);
     }
@@ -321,5 +323,5 @@
         if (error == AL_INVALID_VALUE)
             // @TODO: Follow this constantly appearing, nerve-racking warning
-            COUT(2) << "Sound: OpenAL: Invalid listener position" << std::endl;
+            orxout(internal_error, context::sound) << "OpenAL: Invalid listener position" << endl;
     }
 
@@ -335,5 +337,5 @@
         ALenum error = alGetError();
         if (error == AL_INVALID_VALUE)
-            COUT(2) << "Sound: OpenAL: Invalid listener orientation" << std::endl;
+            orxout(internal_error, context::sound) << "OpenAL: Invalid listener orientation" << endl;
     }
 
@@ -346,5 +348,5 @@
                 if (it->first == newAmbient)
                 {
-                    COUT(2) << "Sound warning: Will not play an AmbientSound twice." << std::endl;
+                    orxout(internal_warning, context::sound) << "Will not play an AmbientSound twice." << endl;
                     return;
                 }
@@ -520,5 +522,5 @@
             catch (const std::exception& ex)
             {
-                COUT(1) << ex.what() << std::endl;
+                orxout(internal_error, context::sound) << ex.what() << endl;
                 return buffer;
             }
@@ -614,5 +616,5 @@
             alDeleteSources(1, &this->availableSoundSources_.back());
             if (alGetError())
-                COUT(1) << "Sound Error: Failed to delete a source --> lost forever" << std::endl;
+                orxout(internal_error, context::sound) << "Failed to delete a source --> lost forever" << endl;
             this->availableSoundSources_.pop_back();
         }
Index: code/trunk/src/orxonox/sound/SoundStreamer.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundStreamer.cc	(revision 8857)
+++ code/trunk/src/orxonox/sound/SoundStreamer.cc	(revision 8858)
@@ -51,5 +51,5 @@
         if (ret < 0)
         {
-            COUT(2) << "Sound: libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << std::endl;
+            orxout(internal_error, context::sound) << "libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << endl;
             ov_clear(&vf);
             return;
@@ -77,5 +77,5 @@
             else if (ret < 0)
             {
-                COUT(2) << "Sound: libvorbisfile: error reading the file" << std::endl;
+                orxout(internal_error, context::sound) << "libvorbisfile: error reading the file" << endl;
                 ov_clear(&vf);
                 return;
@@ -91,6 +91,6 @@
             alGetSourcei(audioSource, AL_BUFFERS_PROCESSED, &processed);
             if (ALint error = alGetError())
-            COUT(2) << "Sound Warning: Couldn't get number of processed buffers: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+            orxout(internal_warning, context::sound) << "Couldn't get number of processed buffers: "
+                                                     << SoundManager::getALErrorString(error) << endl;
 
             if(processed > 0)
@@ -99,6 +99,6 @@
                 alSourceUnqueueBuffers(audioSource, processed, buffers);
                 if (ALint error = alGetError())
-                    COUT(2) << "Sound Warning: Couldn't unqueue buffers: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+                    orxout(internal_warning, context::sound) << "Couldn't unqueue buffers: "
+                                                             << SoundManager::getALErrorString(error) << endl;
 
                 for(int i = 0; i < processed; i++)
@@ -111,5 +111,5 @@
                     else if (ret < 0)
                     {
-                        COUT(2) << "Sound: libvorbisfile: error reading the file" << std::endl;
+                        orxout(internal_error, context::sound) << "libvorbisfile: error reading the file" << endl;
                         ov_clear(&vf);
                         return;
@@ -121,6 +121,6 @@
                 alSourceQueueBuffers(audioSource, processed, buffers);
                 if (ALint error = alGetError())
-                    COUT(2) << "Sound Warning: Couldn't queue buffers: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+                    orxout(internal_warning, context::sound) << "Couldn't queue buffers: "
+                                                             << SoundManager::getALErrorString(error) << endl;
             }
         }
Index: code/trunk/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/WorldSound.cc	(revision 8857)
+++ code/trunk/src/orxonox/sound/WorldSound.cc	(revision 8858)
@@ -94,5 +94,5 @@
             ALenum error = alGetError();
             if (error == AL_INVALID_VALUE)
-                COUT(2) << "Sound: OpenAL: Invalid sound position" << std::endl;
+                orxout(internal_error, context::sound) << "OpenAL: Invalid sound position" << endl;
 
             const Vector3& vel = this->getVelocity();
@@ -100,5 +100,5 @@
             error = alGetError();
             if (error == AL_INVALID_VALUE)
-                COUT(2) << "Sound: OpenAL: Invalid sound velocity" << std::endl;
+                orxout(internal_error, context::sound) << "OpenAL: Invalid sound velocity" << endl;
 
             const Vector3& direction = -this->getWorldOrientation().zAxis();
@@ -106,5 +106,5 @@
             error = alGetError();
             if (error == AL_INVALID_VALUE)
-                COUT(2) << "Sound: OpenAL: Invalid sound direction" << std::endl;
+                orxout(internal_error, context::sound) << "OpenAL: Invalid sound direction" << endl;
         }
     }
Index: code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.cc	(revision 8857)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.cc	(revision 8858)
@@ -188,5 +188,5 @@
             this->munitiontype_ = identifier;
         else
-            COUT(2) << "Warning: No munition class defined in WeaponMode " << this->getName() << std::endl;
+            orxout(internal_warning) << "No munition class defined in WeaponMode " << this->getName() << endl;
         this->updateMunition();
     }
@@ -249,5 +249,4 @@
             Vector3 muzzleDirection;
             muzzleDirection = target - this->muzzlePosition_;
-//             COUT(0) << "muzzleDirection " << muzzleDirection << endl;
             this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation();
         }
Index: code/trunk/src/orxonox/worldentities/BigExplosion.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/BigExplosion.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/BigExplosion.cc	(revision 8858)
@@ -61,5 +61,5 @@
             catch (const std::exception& ex)
             {
-                COUT(1) << "Error: Couln't load particle effect in BigExplosion: " << ex.what() << std::endl;
+                orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl;
                 this->initZero();
             }
Index: code/trunk/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.cc	(revision 8858)
@@ -457,5 +457,5 @@
         }
         else
-            COUT(2) << "Warning: ControllableEntity \"" << this->getName() << "\" already has a Controller." << std::endl;
+            orxout(internal_warning) << "ControllableEntity \"" << this->getName() << "\" already has a Controller." << endl;
     }
 
Index: code/trunk/src/orxonox/worldentities/ExplosionChunk.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ExplosionChunk.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/ExplosionChunk.cc	(revision 8858)
@@ -61,5 +61,5 @@
             catch (const std::exception& ex)
             {
-                COUT(1) << "Error: Couln't load particle effect in ExplosionChunk: " << ex.what() << std::endl;
+                orxout(internal_error) << "Couldn't load particle effect in ExplosionChunk: " << ex.what() << endl;
                 this->fire_ = 0;
                 this->smoke_ = 0;
Index: code/trunk/src/orxonox/worldentities/MobileEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/MobileEntity.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/MobileEntity.cc	(revision 8858)
@@ -189,5 +189,5 @@
         if (type == WorldEntity::Static)
         {
-            CCOUT(1) << "Error: Cannot tell a MobileEntity to have static collision type! Ignoring." << std::endl;
+            orxout(internal_warning) << "Cannot tell a MobileEntity to have static collision type! Ignoring." << endl;
             assert(false); // Only in debug mode
             return false;
Index: code/trunk/src/orxonox/worldentities/SpawnPoint.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/SpawnPoint.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/SpawnPoint.cc	(revision 8858)
@@ -48,5 +48,5 @@
             this->getGametype()->registerSpawnPoint(this);
         else
-            COUT(1) << "Error: SpawnPoint has no Gametype" << std::endl;
+            orxout(internal_error) << "SpawnPoint has no Gametype" << endl;
 
         this->setSyncMode(ObjectDirection::None);
Index: code/trunk/src/orxonox/worldentities/StaticEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/StaticEntity.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/StaticEntity.cc	(revision 8858)
@@ -63,5 +63,5 @@
         if (this->addedToPhysicalWorld())
         {
-            CCOUT(2) << "Warning: Attempting to change the position of a StaticEntity at physics run time. Ignoring change." << std::endl;
+            orxout(internal_warning) << "Attempting to change the position of a StaticEntity at physics run time. Ignoring change." << endl;
             return;
         }
@@ -80,5 +80,5 @@
         if (this->addedToPhysicalWorld())
         {
-            CCOUT(2) << "Warning: Attempting to change the orientation of a StaticEntity at physics run time. Ignoring change." << std::endl;
+            orxout(internal_warning) << "Attempting to change the orientation of a StaticEntity at physics run time. Ignoring change." << endl;
             return;
         }
@@ -97,5 +97,5 @@
         if (type == WorldEntity::Kinematic || type == WorldEntity::Dynamic)
         {
-            CCOUT(1) << "Error: Cannot tell a StaticEntity to have kinematic or dynamic collision type! Ignoring." << std::endl;
+            orxout(internal_warning) << "Cannot tell a StaticEntity to have kinematic or dynamic collision type! Ignoring." << endl;
             assert(false); // Only in debug mode
             return false;
Index: code/trunk/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.cc	(revision 8858)
@@ -95,5 +95,5 @@
         this->collisionType_             = None;
         this->collisionTypeSynchronised_ = None;
-        this->mass_           = 0;
+        this->mass_           = 1.0f;
         this->childrenMass_   = 0;
         // Using bullet default values
@@ -311,10 +311,10 @@
             this->collisionTypeSynchronised_ != None)
         {
-            CCOUT(1) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << std::endl;
+            orxout(internal_error) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << endl;
         }
         else if (this->collisionTypeSynchronised_ != collisionType_)
         {
             if (this->parent_)
-                CCOUT(2) << "Warning: Network connection tried to set the collision type of an attached WE. Ignoring." << std::endl;
+                orxout(internal_warning) << "Network connection tried to set the collision type of an attached WE. Ignoring." << endl;
             else
                 this->setCollisionType(this->collisionTypeSynchronised_);
@@ -373,5 +373,5 @@
         if (object == this)
         {
-            COUT(2) << "Warning: Can't attach a WorldEntity to itself." << std::endl;
+            orxout(internal_warning) << "Can't attach a WorldEntity to itself." << endl;
             return;
         }
@@ -406,20 +406,20 @@
             if (!newParent->hasPhysics())
             {
-                COUT(2) << "Warning: Cannot attach a physical object to a non physical one." << std::endl;
+                orxout(internal_warning) << " Cannot attach a physical object to a non physical one." << endl;
                 return false;
             }
             else if (this->isDynamic())
             {
-                COUT(2) << "Warning: Cannot attach a dynamic object to a WorldEntity." << std::endl;
+                orxout(internal_warning) << "Cannot attach a dynamic object to a WorldEntity." << endl;
                 return false;
             }
             else if (this->isKinematic() && newParent->isDynamic())
             {
-                COUT(2) << "Warning: Cannot attach a kinematic object to a dynamic one." << std::endl;
+                orxout(internal_warning) << "Cannot attach a kinematic object to a dynamic one." << endl;
                 return false;
             }
             else if (this->isKinematic())
             {
-                COUT(2) << "Warning: Cannot attach a kinematic object to a static or kinematic one: Not yet implemented." << std::endl;
+                orxout(internal_warning) << "Cannot attach a kinematic object to a static or kinematic one: Not yet implemented." << endl;
                 return false;
             }
@@ -455,5 +455,5 @@
         if (it == this->children_.end())
         {
-            CCOUT(2) << "Warning: Cannot detach an object that is not a child." << std::endl;
+            orxout(internal_warning) << "Cannot detach an object that is not a child." << endl;
             return;
         }
@@ -799,5 +799,5 @@
         if (this->parent_)
         {
-            CCOUT(2) << "Warning: Cannot set the collision type of a WorldEntity with a parent." << std::endl;
+            orxout(internal_warning) << "Cannot set the collision type of a WorldEntity with a parent." << endl;
             return;
         }
@@ -822,5 +822,5 @@
             if (!this->node_->getScale().positionEquals(Vector3(1, 1, 1), 0.001))
             {
-                CCOUT(2) << "Warning: Cannot create a physical body if there is scaling applied to the node: Not yet implemented." << std::endl;
+                orxout(internal_warning) << "Cannot create a physical body if there is scaling applied to the node: Not yet implemented." << endl;
                 return;
             }
@@ -968,8 +968,8 @@
                 this->physicalBody_->setMassProps(0.0f, btVector3(0, 0, 0));
             }
-            else if ((this->mass_ + this->childrenMass_) == 0.0f)
+            else if (totalMass == 0.0f)
             {
                 // Use default values to avoid very large or very small values
-                CCOUT(4) << "Warning: Setting the internal physical mass to 1.0 because mass_ is 0.0" << std::endl;
+                orxout(internal_warning) << "Setting the internal physical mass to 1.0 because mass_ is 0.0" << endl;
                 btVector3 inertia(0, 0, 0);
                 this->collisionShape_->calculateLocalInertia(1.0f, inertia);
Index: code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc	(revision 8858)
@@ -132,5 +132,5 @@
         if (type != WorldEntity::Dynamic)
         {
-            CCOUT(1) << "Error: Cannot tell a FpsPlayer not to be dynamic! Ignoring." << std::endl;
+            orxout(internal_warning) << "Cannot tell a FpsPlayer not to be dynamic! Ignoring." << endl;
             assert(false); // Only in debug mode
             return false;
Index: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc	(revision 8857)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc	(revision 8858)
@@ -145,5 +145,5 @@
         if (type != WorldEntity::Dynamic)
         {
-            CCOUT(1) << "Error: Cannot tell a SpaceShip not to be dynamic! Ignoring." << std::endl;
+            orxout(internal_warning) << "Cannot tell a SpaceShip not to be dynamic! Ignoring." << endl;
             assert(false); // Only in debug mode
             return false;
@@ -507,5 +507,5 @@
         if (camera == 0)
         {
-            COUT(2) << "Failed to reset camera!";
+            orxout(internal_warning) << "Failed to reset camera!" << endl;
             return;
         }
