Help language development. Donate to The Perl Foundation
IRC::Client::Plugin::Logger - IRC logger for historic purposes
use IRC::Client; use IRC::Client::Plugin::Logger; .run with IRC::Client.new( :nick<SomeBot>, :host<irc.freenode.org>, :channels<#channel1 #channel2>, :plugins(IRC::Client::Plugin::Logger.new(:directory<logs>,:debug)), )
IRC::Client::Plugin::Logger exports a class that is to be used as a plugin of the IRC::Client framework.
It is a simple IRC logger for
historical purposes, so not for forensic logging. As such, it does not keep IP number information, user names nor exact timestamps.
It produces logs compatible with the "raw" format of the colabti.org IRC logger, which contains hh::mm timestamps, join / leave / nick notices and messages sent to the channel. It will not log messages that start with '[off]'.
The directory in which the logs should be placed. It should be writable by the process that runs the
A numeric value to indicate debug level. If it is non-zero, it will produce debugging output on STDERR.
Callable that should return a
DateTime object to be used to determine date and time an event should be logged. Defaults to the current time in UTC. Mostly intended for testing purposes to get a reproducible logging result, but can also be used to e.g. have times logged in local time.
From the given directory, a directory will be made for each channel (excluding the
# prefix). Inside it, a directory will be made for each year in which messages are logged. Inside that, a file will be made for each day that messages are logged, with the name of the format
So, for logging the #raku channel on 22 April 2021 with a directory setting of
~/logs, you will get:
Elizabeth Mattijsen [email protected]
Source can be located at: https://github.com/lizmat/IRC-Client-Plugin-Logger . Comments and Pull Requests are welcome.
Copyright 2021 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.