Index: code/branches/output/src/libraries/util/CMakeLists.txt
===================================================================
--- code/branches/output/src/libraries/util/CMakeLists.txt	(revision 8849)
+++ code/branches/output/src/libraries/util/CMakeLists.txt	(revision 8850)
@@ -46,4 +46,5 @@
   output/LogWriter.cc
   output/MemoryWriter.cc
+  output/SubcontextOutputListener.cc
 )
 
Index: code/branches/output/src/libraries/util/output/BaseWriter.cc
===================================================================
--- code/branches/output/src/libraries/util/output/BaseWriter.cc	(revision 8849)
+++ code/branches/output/src/libraries/util/output/BaseWriter.cc	(revision 8850)
@@ -33,5 +33,5 @@
 namespace orxonox
 {
-    BaseWriter::BaseWriter(const std::string& name, bool bRegister) : OutputListener(bRegister)
+    BaseWriter::BaseWriter(const std::string& name, bool bRegister) : SubcontextOutputListener(bRegister)
     {
         this->name_ = name;
@@ -40,7 +40,4 @@
         this->configurableAdditionalContextsMaxLevel_ = level::verbose;
         this->configurableAdditionalContexts_.push_back("example");
-
-        this->subcontextsCheckMask_ = context::none;
-        this->subcontextsNoCheckMask_ = context::none;
 
         this->changedConfigurableLevel();
@@ -55,14 +52,9 @@
     void BaseWriter::output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
     {
-        if (((this->subcontextsCheckMask_ & context.mask) == 0) ||
-            (this->subcontextsNoCheckMask_ & context.mask) ||
-            (this->subcontexts_.find(context.sub_id) != this->subcontexts_.end()))
-        {
-            const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context);
-            std::string blanks(prefix.length(), ' ');
+        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);
-        }
+        for (size_t i = 0; i < lines.size(); ++i)
+            this->printLine((i == 0 ? prefix : blanks) + lines[i], level);
     }
 
@@ -91,9 +83,6 @@
     void BaseWriter::changedConfigurableAdditionalContexts()
     {
-        OutputContextMask context_mask = context::none;
-        this->subcontextsCheckMask_ = context::none;
-        this->subcontextsNoCheckMask_ = context::none;
-
-        this->subcontexts_.clear();
+        OutputContextMask main_contexts = context::none;
+        std::set<const OutputContextContainer*> sub_contexts;
 
         for (size_t i = 0; i < this->configurableAdditionalContexts_.size(); ++i)
@@ -111,20 +100,14 @@
             }
 
-            const OutputContextContainer& container = OutputManager::getInstance().registerContext(name, subname);
+            const OutputContextContainer& context = OutputManager::getInstance().registerContext(name, subname);
 
-            context_mask |= container.mask;
-
-            if (container.sub_id != context::no_subcontext)
-            {
-                this->subcontexts_.insert(container.sub_id);
-                this->subcontextsCheckMask_ |= container.mask;
-            }
+            if (context.sub_id == context::no_subcontext)
+                main_contexts |= context.mask;
             else
-            {
-                this->subcontextsNoCheckMask_ |= container.mask;
-            }
+                sub_contexts.insert(&context);
         }
 
-        this->setAdditionalContextsMask(context_mask);
+        this->setAdditionalContextsMask(main_contexts);
+        this->setAdditionalSubcontexts(sub_contexts);
     }
 }
Index: code/branches/output/src/libraries/util/output/BaseWriter.h
===================================================================
--- code/branches/output/src/libraries/util/output/BaseWriter.h	(revision 8849)
+++ code/branches/output/src/libraries/util/output/BaseWriter.h	(revision 8850)
@@ -31,13 +31,9 @@
 
 #include "util/UtilPrereqs.h"
-
-#include <set>
-#include <vector>
-
-#include "OutputListener.h"
+#include "SubcontextOutputListener.h"
 
 namespace orxonox
 {
-    class _UtilExport BaseWriter : public OutputListener
+    class _UtilExport BaseWriter : public SubcontextOutputListener
     {
         public:
@@ -83,8 +79,4 @@
 
             std::string name_;
-
-            OutputContextMask subcontextsCheckMask_;
-            OutputContextMask subcontextsNoCheckMask_;
-            std::set<OutputContextSubID> subcontexts_;
     };
 }
Index: code/branches/output/src/libraries/util/output/OutputListener.cc
===================================================================
--- code/branches/output/src/libraries/util/output/OutputListener.cc	(revision 8849)
+++ code/branches/output/src/libraries/util/output/OutputListener.cc	(revision 8850)
@@ -130,3 +130,20 @@
         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/branches/output/src/libraries/util/output/OutputListener.h
===================================================================
--- code/branches/output/src/libraries/util/output/OutputListener.h	(revision 8849)
+++ code/branches/output/src/libraries/util/output/OutputListener.h	(revision 8850)
@@ -75,9 +75,5 @@
                 { return this->additionalContextsLevelMask_; }
 
-            /// @brief Returns true if this listener accepts output of the given level and context, based on the levels and contexts masks.
-            inline bool acceptsOutput(OutputLevel level, const OutputContextContainer& context) const
-            {
-                return (this->levelMask_ & level) ||
-                       ((this->additionalContextsLevelMask_ & level) && (this->additionalContextsMask_ & context.mask)); }
+            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.
Index: code/branches/output/src/libraries/util/output/SubcontextOutputListener.cc
===================================================================
--- code/branches/output/src/libraries/util/output/SubcontextOutputListener.cc	(revision 8850)
+++ code/branches/output/src/libraries/util/output/SubcontextOutputListener.cc	(revision 8850)
@@ -0,0 +1,92 @@
+/*
+ *   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 "SubcontextOutputListener.h"
+
+namespace orxonox
+{
+    SubcontextOutputListener::SubcontextOutputListener(bool bRegister) : OutputListener(bRegister)
+    {
+        this->subcontextsCheckMask_ = context::none;
+        this->subcontextsNoCheckMask_ = context::none;
+    }
+
+    SubcontextOutputListener::~SubcontextOutputListener()
+    {
+    }
+
+    void SubcontextOutputListener::setAdditionalContextsMask(OutputContextMask mask)
+    {
+        this->subcontextsNoCheckMask_ = mask;
+
+        OutputListener::setAdditionalContextsMask(this->subcontextsCheckMask_ | this->subcontextsNoCheckMask_);
+    }
+
+    void SubcontextOutputListener::setAdditionalSubcontexts(const std::set<const OutputContextContainer*>& subcontexts)
+    {
+        this->subcontextsCheckMask_ = context::none;
+        this->subcontexts_.clear();
+
+        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, contexts masks, and 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/branches/output/src/libraries/util/output/SubcontextOutputListener.h
===================================================================
--- code/branches/output/src/libraries/util/output/SubcontextOutputListener.h	(revision 8850)
+++ code/branches/output/src/libraries/util/output/SubcontextOutputListener.h	(revision 8850)
@@ -0,0 +1,64 @@
+/*
+ *   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
+{
+    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_;
+            OutputContextMask subcontextsNoCheckMask_;
+            std::set<OutputContextSubID> subcontexts_;
+    };
+}
+
+#endif /* _SubcontextOutputListener_H__ */
