1POE::Component::IRC::PlUusgeirn:C:oLnotgrgiebru(t3e)d PePrOlE:D:oCcoummpeonnteantti:o:nIRC::Plugin::Logger(3)
2
3
4
6 POE::Component::IRC::Plugin::Logger - A PoCo-IRC plugin which logs
7 public, private, and DCC chat messages to disk
8
10 use POE::Component::IRC::Plugin::Logger;
11
12 $irc->plugin_add('Logger', POE::Component::IRC::Plugin::Logger->new(
13 Path => '/home/me/irclogs',
14 DCC => 0,
15 Private => 0,
16 Public => 1,
17 ));
18
20 POE::Component::IRC::Plugin::Logger is a POE::Component::IRC plugin. It
21 logs messages and CTCP ACTIONs to either #some_channel.log or
22 some_nickname.log in the supplied path. In the case of DCC chats, a '='
23 is prepended to the nickname (like in irssi).
24
25 The plugin tries to detect UTF-8 encoding of every message or else
26 falls back to CP1252, like irssi (and, supposedly, mIRC) does by
27 default. Resulting log files will be UTF-8 encoded. The default log
28 format is similar to xchat's, except that it's sane and parsable.
29
30 This plugin requires the IRC component to be POE::Component::IRC::State
31 or a subclass thereof. It also requires a
32 POE::Component::IRC::Plugin::BotTraffic to be in the plugin pipeline.
33 It will be added automatically if it is not present.
34
36 "new"
37 Arguments:
38
39 'Path', the place where you want the logs saved.
40
41 'Private', whether or not to log private messages. Defaults to 1.
42
43 'Public', whether or not to log public messages. Defaults to 1.
44
45 'DCC', whether or not to log DCC chats. Defaults to 1.
46
47 'Notices', whether or not to log NOTICEs. Defaults to 0.
48
49 'Sort_by_date', whether or not to split log files by date, i.e.
50 #channel/YYYY-MM-DD.log instead of #channel.log. If enabled, the date
51 will be omitted from the timestamp. Defaults to 0.
52
53 'Strip_color', whether or not to strip all color codes from messages.
54 Defaults to 0.
55
56 'Strip_formatting', whether or not to strip all formatting codes from
57 messages. Defaults to 0.
58
59 'Restricted', set this to 1 if you want all directories/files to be
60 created without read permissions for other users (i.e. 700 for dirs and
61 600 for files). Defaults to 1.
62
63 'Format', a hash reference representing the log format, if you want to
64 define your own. See the source for details.
65
66 'Log_sub', a subroutine reference which can be used to override the
67 file logging. Use this if you want to store logs in a database instead,
68 for example. It will be called with 3 arguments: the context (a channel
69 name or nickname), a type (e.g. 'privmsg' or '+b', and any arguments to
70 that type. You can make use "default_format" to create logs that match
71 the default log format. Note: You must take care of handling date/time
72 and stripping colors/formatting codes yourself.
73
74 Returns a plugin object suitable for feeding to POE::Component::IRC's
75 "plugin_add" method.
76
77 "default_format"
78 Returns a hash reference of type/subroutine pairs, for formatting logs
79 according to the default log format.
80
82 Hinrik Örn Sigurðsson, hinrik.sig@gmail.com
83
84
85
86perl v5.34.0 2021-07P-O2E2::Component::IRC::Plugin::Logger(3)