Monday, January 23rd, 2012, 2:25 pm
How to Quickly Produce HTML-Formatted IRC Logs
N a daily basis I must produce logs for 4 IRC channels. Over time I found more efficient ways for doing so and this post summarises some of the shortcuts and tools. It doesn’t go into specifics where these are not generalisable.
The first stage is opening a template for the post/article linking to the log/s. The post has X’s where the data goes, so that part must be completed by hand and then copied and pasted into the right fields. The way this is done depends on the site and its layout, but the important thing is, use templates. If this gets done daily, then a lot of work and many errors can be prevented.
Then comes the point where the logs themselves get produced. Logging is typically done by IRC clients, but only XChat works well for me with the script that I use since 2008, irclog2html. The first thing to do is open all the files containing the relevant logs. In my case it goes like this:
roy@roy:~$ cat ./irc-files.sh kate .xchat2/xchatlogs/FreeNode-#boycottnovell.log .xchat2/xchatlogs/FreeNode-#boycottnovell-social.log .xchat2/xchatlogs/FreeNode-#techbytes.log .xchat2/xchatlogs/FreeNode-#techrights.log
The directory and relative paths may vary and one’s favourite text editor may vary as well (I like Kate). Once all the files are open (about 200 MB in my case), open all the previous logs (if any) and scroll down to the bottom. Then, copy a portion of the last line and search for it in the full log to quickly jump to the latest log line, then extend the selection (highlight with keyboard/mouse) to grab the new log text to be converted into HTML. Once this is done, open a new tab/windows, paste the text, and save the text as a file whose name is corresponding to the channel at hand. In my case, that would be irc-log-social
, irc-log-techbytes
, irc-log-techrights
, and irc-log
.
Once all the text to be converted is put in the correctly and consistently named files, batch-run the conversion and open the resultant files in a text editor. For example:
python ./Main/Programs/irclog2html.py irc-log-techrights --title='IRC: #techrights @ FreeNode: January 22nd, 2012' ; python ./Main/Programs/irclog2html.py irc-log --title='IRC: #boycottnovell @ FreeNode: January 22nd, 2012' ; python ./Main/Programs/irclog2html.py irc-log-social --title='IRC: #boycottnovell-social @ FreeNode: January 22nd, 2012' ; python ./Main/Programs/irclog2html.py irc-log-techbytes --title='IRC: #techbytes @ FreeNode: January 22nd, 2012' ; kate irc-log.html irc-log-social.html irc-log-techrights.html irc-log-techbytes.html
This is basically a simple command run about 4 times, then 4 files opened. Python is needed to run irclog2html.py
and there is room for some parameters like page titles. The opening of the resultant files then makes it possible to save under date-stamped files all the logs separately, then upload them and link to them in the template post. That’s about it. If there are any questions about these very basic efficiency tricks, drop me a line. Having published thousands of logs, it is an area I’m quite familiar with.