logsink.cpp
/*
Copyright (c) 2005-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#include "logsink.h"
namespace gloox
{
LogSink::LogSink()
{
}
LogSink::~LogSink()
{
}
void LogSink::log( LogLevel level, LogArea area, const std::string& message ) const
{
LogHandlerMap::const_iterator it = m_logHandlers.begin();
for( ; it != m_logHandlers.end(); ++it )
{
if( (*it).first && ( (*it).second.level <= level ) && ( (*it).second.areas & area ) )
(*it).first->handleLog( level, area, message );
}
}
void LogSink::registerLogHandler( LogLevel level, int areas, LogHandler* lh )
{
LogInfo info = { level, areas };
m_logHandlers[lh] = info;
}
void LogSink::removeLogHandler( LogHandler* lh )
{
m_logHandlers.erase( lh );
}
}
gloox::LogHandler
A virtual interface which can be reimplemented to receive debug and log messages.
Definition loghandler.h:34
gloox::LogSink::registerLogHandler
void registerLogHandler(LogLevel level, int areas, LogHandler *lh)
Definition logsink.cpp:38
gloox::LogSink::removeLogHandler
void removeLogHandler(LogHandler *lh)
Definition logsink.cpp:44
gloox::LogSink::LogSink
LogSink()
Definition logsink.cpp:20
gloox::LogSink::~LogSink
virtual ~LogSink()
Definition logsink.cpp:24
gloox::LogSink::log
void log(LogLevel level, LogArea area, const std::string &message) const
Definition logsink.cpp:28
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::LogArea
LogArea
Definition gloox.h:1053
gloox::LogLevel
LogLevel
Definition gloox.h:1080