publish-bot with logging capability
Posted on August 19, 2007 by oubiwann

Last year sometime, I received several emails from people wanting me to release the supybot IRC plugins I wrote back in 2005 for svn and RSS updates. I'd actually written for several different IRC bots (both twisted-based, and non-twisted bots) but the code was particularly messy for supybot. During one conversation, I said that I'd really done it all wrong, and the last thing I wanted to do was clean up wrong code. If I got a chance, I would do it right:
- create an IRC client for communicating to servers+channels
- create a message server running on local host
- process/parse data from the local server to the IRC client (i.e., appropriate IRC channel)
Turns out radix did just so earlier this year for Canonical, as he relates in this blog post. This is exactly what I needed this weekend while migrating my old IRC bot to a new server. Well, almost all I needed. There were a couple features I wanted to add...
Not having worked with bzr or launchpad much, I asked radix about branching his code, since I heard that Canonical actually provides developers a way of doing that without leaving the launchpad environment of trunk. His instructions were quite simple, and I summarize them here for the benefit of others:
- find the project you want to branch on launchpad
- checkout trunk (if that's what you're branching)
- commit (a local action) with a message about this being a new branch
- make your changes (with any number of commits)
- push all your commits to your branch on launchpad
Here are the bzr commands that I used:
bzr branch http://bazaar.launchpad.net/~radix/publish-bot/trunk publish-logger-botThe changes I committed:
cd publish-logger-bot
bzr commit –unchanged -m "Created branch of radix's publish-bot."
bzr push sftp://oubiwann@bazaar.launchpad.net/~oubiwann/publish-bot/publish-logger-bot< br />
- enabled logging
- added log-rotation
- added an HTTP service for browsing the log files
htt ps://code.launchpad.net/~oubiwann/publish-bot/publish-logger-bot
Forthcoming features:
- a search form for the log files
- a parser for bot commands, thus enabling human -> bot communications (will probably dust off my old pyparsing code for this)
- arbitrary time log rotation (currently it's by day, ad midnight)
And for dessert:
[18-Aug-2007 17:56:50] [connected at Sat Aug 18 17:56:50 2007]
[18-Aug-2007 17:57:00] [wallflower (logger bot) has joinedsupersecretchannel]
wallflower?
[18-Aug-2007 18:00:38] <keturn> what's a
[18-Aug-2007 18:20:09] <PenguinOfDoom> It's a flower that grows out of a wall
[18-Aug-2007 18:20:52] <keturn> and has an irc client?
[18-Aug-2007 18:22:49] <keturn> is it related to an oubiwann?
[18-Aug-2007 18:34:00] <exarkun> I reckon it is
Technorati Tags: bzr, canonical, irc, python, software, twisted, web
Comments?
This blog doesn't use standard (embedded) comments; however, since
the site is hosted on Github, if there is
something you'd like to share, please do so by
opening a
"comment" ticket!