irclog.parser — IRC log parser

This module provides a function which takes lines of log then transforms it to message objects in irclog.messages module.


The re pattern matches to a line of IRC log message.


This regular expression is originally written by Kang Seonghoon aka lifthrasiir. This pattern is posted in an article of LangDev.

irclog.parser.parse(lines, date=None, encoding='utf-8')[source]

Transforms lines of log to message objects in irclog.messages module.

  • lines (iterable object, file object) – lines of code
  • date ( – a date of the log. default is today
  • encoding – a text encoding. default is "utf-8"

a list of irclog.messages.BaseMessage instances


This is exactly a generator function.


Registers a parser function.

Parameters:function (callable object) – a function parses to register
Returns:passed function
irclog.parser.nickmsg(when, nickfrom, nickto, **_)[source]

Parses irclog.messages.NickMessage.

irclog.parser.selfnickmsg(when, selfnickto, **_)[source]

Parses irclog.messages.SelfNickMessage.

irclog.parser.joinmsg(when, joinnick, joinident, joinchan, **_)[source]

Parses irclog.messages.JoinMessage.

irclog.parser.modemsg(when, modeserver, modechan, modelist, modenick, **_)[source]

Parses irclog.messages.ModeMessage.

irclog.parser.partmsg(when, partnick, partident, partchan, partreason, **_)[source]

Parses irclog.messages.PartMessage.

irclog.parser.quitmsg(when, quitnick, quitident, quitreason, **_)[source]

Parses irclog.messages.QuitMessage.

irclog.parser.kickmsg(when, kicknick, kickchan, kickby, kickreason, **_)[source]

Parses irclog.messages.KickMessage.

irclog.parser.topicmsg(when, topicnick, topicchan, topicline, **_)[source]

Parses irclog.messages.TopicMessage.

irclog.parser.notopicmsg(when, notopicnick, notopicchan, **_)[source]

Parses irclog.messages.NoTopicMessage.

irclog.parser.pubmsg(when, pubnick, publine, **_)[source]

Parses irclog.messages.PublicMessage.

irclog.parser.actmsg(when, actnick, actline, **_)[source]

Parses irclog.messages.ActionMessage.

irclog.parser.noticemsg(when, noticenick, noticechan, noticeline, **_)[source]

Parses irclog.messages.ActionMessage.