Skip to content

ghisguth/debugirc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

debugircd
=======================
debug irc interface

log4cplus example:

class IrcLogServiceAppender
	: public log4cplus::Appender
{
public:
	IrcLogServiceAppender(const boost::shared_ptr<debugirc::Server> & ircserver)
		: ircserver_(ircserver)
	{}
	virtual ~IrcLogServiceAppender() {}
	public:
		// member functions inherited from the Appender interface class
		virtual void close() {}
	protected:
		virtual void append(const log4cplus::spi::InternalLoggingEvent& event)
		{
			std::string formatted_string(log_level_manager_.toString(event.getLogLevel()));
			formatted_string += ' ';
			formatted_string += event.getLoggerName();
			formatted_string += " - ";
			formatted_string += event.getMessage();
			ircserver_->GetChat().DeliverChannel("#log", formatted_string);
		}
	private:
		log4cplus::LogLevelManager      log_level_manager_;
		boost::shared_ptr<debugirc::Server> ircserver_;
};

boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 16667);
boost::shared_ptr<debugirc::Server> irclog_ = boost::shared_ptr<debugirc::Server>(new debugirc::Server(io_service, endpoint));
irclog_->GetChat().AddChannel("#log", "Log");
irclog_->GetChat().SetAutoJoin("#log");

log4cplus::SharedAppenderPtr irclog_appender_ = log4cplus::SharedAppenderPtr(new IrcLogServiceAppender(irclog_));
irclog_appender_->setName("IrcLogServiceAppender");
log4cplus::Logger::getRoot().addAppender(irclog_appender_.get());

io_service.run();

log4cplus::Logger::getRoot().removeAppender(irclog_appender_);

About

simple irc server for debug output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages