Bot-Cobalt
view release on metacpan or search on metacpan
lib/Bot/Cobalt/Logger.pm view on Meta::CPAN
my $accept = $self->_levmap->{ $self->level };
$accept >= $num_lev ? 1 : 0
}
sub _log_to_level {
my ($self, $level) = splice @_, 0, 2;
$self->output->_write(
$level,
[ caller(1) ],
@_
) if $self->_should_log($level);
1
}
sub debug { shift->_log_to_level( 'debug', @_ ) }
sub info { shift->_log_to_level( 'info', @_ ) }
sub warn { shift->_log_to_level( 'warn', @_ ) }
sub error { shift->_log_to_level( 'error', @_ ) }
lib/Bot/Cobalt/Timer.pm view on Meta::CPAN
=head3 id
This timer's unique identifier, used as a key in timer pools.
Note that a unique random ID is added when the Timer object is passed to
L<Bot::Cobalt::Core::Role::Timers/timer_set> if no B<id> is explicitly
specified.
=head3 alias
The alias tag attached to this timer. Defaults to C<caller()>
=head3 type
The type of event.
Valid types as of this writing are B<msg>, B<action>, and B<event>.
B<msg> and B<action> types require L</context>, L</text>, and L</target>
attributes be specified.
t/02_logger/03_output.t view on Meta::CPAN
'add() file and term'
);
my $stdout;
{
local *STDOUT;
open STDOUT, '>', \$stdout
or die "Could not reopen STDOUT: $!";
ok(
$output->_write('info', [caller(0)], "Testing", "things"),
'_write()'
);
close STDOUT
}
ok( $stdout, "Logged to STDOUT" );
ok(
do { local (@ARGV, $/) = $test_log_path; <> },
( run in 2.428 seconds using v1.01-cache-2.11-cpan-a9ef4e587e4 )