NAME

IRC::Bot::Log::Extended - extends IRC::Bot::Log for IRC::Bot

SYNOPSIS

#!/usr/bin/perl -w

package IRC::Bot2;

use Moose;
extends 'IRC::Bot';
use IRC::Bot::Log::Extended;

after 'bot_start' => sub {
    my $self = shift;

    no warnings;
    $IRC::Bot::log =  IRC::Bot::Log::Extended->new(
        Path          => $self->{'LogPath'},
        split_channel => 1,
        split_day     => 1,
    );
};

package main;

# Initialize new object
my $bot = IRC::Bot2->new( # check IRC::Bot for more details
    Debug    => 0,
    Nick     => 'Fayland',
    Server   => 'irc.perl.org',
    Channels => [ '#moose', '#catalyst', '#dbix-class' ],
    LogPath  => '/home/fayland/irclog/',
);

# Daemonize process
$bot->daemon();

# Run the bot
$bot->run();

1;

DESCRIPTION

The SYNOPSIS above does two tasks.

  1. it creates a custom IRC::Bot2 based on IRC::Bot. The only differece is override $IRC::Bot::log with

    $IRC::Bot::log =  IRC::Bot::Log::Extended->new(
        Path          => $self->{'LogPath'},
        split_channel => 1,
        split_day     => 1,
    );
  2. the usage of IRC::Bot2 is the same as IRC::Bot. no difference. read IRC::Bot for configuration and usage.

ATTRIBUTES

IRC::Bot::Log stores all channels all days into one file channel.log. it is not so good to read. IRC::Bot::Log::Extended splits the log into several files by channel AND|OR day.

Path

the place moose_20081009.log stores.

split_channel

default is 1. Instead store all log into channel.log, we split them into moose.log, catalyst.log and dbix-class.log

split_day

default is 1. Instead store all log into channel.log or moose.log, we split them into channel_20081009.log, channel_20081010.log (moose_20081010.log) and etc. daily.

SEE ALSO

IRC::Bot, IRC::Bot::Log, Moose

AUTHOR

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Copyright 2008 Fayland Lam, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.