logsink.cpp

00001 /*
00002   Copyright (c) 2005-2006 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 
00015 #include "logsink.h"
00016 
00017 namespace gloox
00018 {
00019 
00020   LogSink::LogSink()
00021     : m_fileFilter( 0 )
00022   {
00023   }
00024 
00025   LogSink::~LogSink()
00026   {
00027   }
00028 
00029   void LogSink::log( LogLevel level, LogArea area, const std::string& message ) const
00030   {
00031     LogHandlerMap::const_iterator it = m_logHandlers.begin();
00032     for( ; it != m_logHandlers.end(); ++it )
00033     {
00034       if( (*it).first && ( (*it).second.level <= level ) && ( (*it).second.areas & area ) )
00035         (*it).first->handleLog( level, area, message );
00036     }
00037   }
00038 
00039   void LogSink::registerLogHandler( LogLevel level, int areas, LogHandler *lh )
00040   {
00041     LogInfo info = { level, areas };
00042     m_logHandlers[lh] = info;
00043   }
00044 
00045   void LogSink::removeLogHandler( LogHandler *lh )
00046   {
00047     m_logHandlers.erase( lh );
00048   }
00049 
00050 }

Generated on Tue May 1 14:20:20 2007 for gloox by  doxygen 1.5.1