Venus::Log - Log Class
Log Class for Perl 5
package main; use Venus::Log; my $log = Venus::Log->new; # $log->trace(time, 'Something failed!'); # "0000000000 Something failed!" # $log->error(time, 'Something failed!'); # "0000000000 Something failed!"
This package provides methods for logging information using various log levels.
This package has the following attributes:
handler(CodeRef $code) (CodeRef)
The handler attribute holds the callback that handles logging.
Since 1.68
1.68
# given: synopsis package main; my $handler = $log->handler; my $events = []; $handler = $log->handler(sub{push @$events, [@_]});
level(Str $name) (Str)
The level attribute holds the current log level.
# given: synopsis package main; my $level = $log->level; # "trace" $level = $log->level('fatal'); # "fatal"
separator(Any $data) (Any)
The separator attribute holds the value used to join multiple log message arguments.
# given: synopsis package main; my $separator = $log->separator; # "" $separator = $log->separator("\n"); # "\n"
This package inherits behaviors from:
Venus::Kind::Utility
This package integrates behaviors from:
Venus::Role::Buildable
This package provides the following methods:
debug(Str @data) (Log)
The debug method logs debug information and returns the invocant.
debug
# given: synopsis package main; # $log = $log->debug(time, 'Something failed!'); # "0000000000 Something failed!"
# given: synopsis package main; # $log->level('info'); # $log = $log->debug(time, 'Something failed!'); # noop
error(Str @data) (Log)
The error method logs error information and returns the invocant.
error
# given: synopsis package main; # $log = $log->error(time, 'Something failed!'); # "0000000000 Something failed!"
# given: synopsis package main; # $log->level('fatal'); # $log = $log->error(time, 'Something failed!'); # noop
fatal(Str @data) (Log)
The fatal method logs fatal information and returns the invocant.
fatal
# given: synopsis package main; # $log = $log->fatal(time, 'Something failed!'); # "0000000000 Something failed!"
# given: synopsis package main; # $log->level('unknown'); # $log = $log->fatal(time, 'Something failed!'); # noop
info(Str @data) (Log)
The info method logs info information and returns the invocant.
info
# given: synopsis package main; # $log = $log->info(time, 'Something failed!'); # "0000000000 Something failed!"
# given: synopsis package main; # $log->level('warn'); # $log = $log->info(time, 'Something failed!'); # noop
input(Str @data) (Str)
The input method returns the arguments provided to the log level methods, to the "output", and can be overridden by subclasses.
# given: synopsis package main; my @input = $log->input(1, 'Something failed!'); # (1, 'Something failed!')
output(Str @data) (Str)
The output method returns the arguments returned by the "input" method, to the log handler, and can be overridden by subclasses.
# given: synopsis package main; my $output = $log->output(time, 'Something failed!'); # "0000000000 Something failed!"
string(Any $data) (Str)
The string method returns a stringified representation of any argument provided and is used by the "output" method.
# given: synopsis package main; my $string = $log->string; # ""
# given: synopsis package main; my $string = $log->string('Something failed!'); # "Something failed!"
# given: synopsis package main; my $string = $log->string([1,2,3]); # [1,2,3]
# given: synopsis package main; my $string = $log->string(bless({})); # "bless({}, 'main')"
trace(Str @data) (Log)
The trace method logs trace information and returns the invocant.
trace
# given: synopsis package main; # $log = $log->trace(time, 'Something failed!'); # "0000000000 Something failed!"
# given: synopsis package main; # $log->level('debug'); # $log = $log->trace(time, 'Something failed!'); # noop
warn(Str @data) (Log)
The warn method logs warn information and returns the invocant.
warn
# given: synopsis package main; # $log = $log->warn(time, 'Something failed!'); # "0000000000 Something failed!"
# given: synopsis package main; # $log->level('error'); # $log = $log->warn(time, 'Something failed!'); # noop
write(Any @data) (Log)
The write method invokes the log handler, i.e. "handler", and returns the invocant.
# given: synopsis package main; # $log = $log->write(time, 'Something failed!'); # bless(..., "Venus::Log")
Awncorp, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2000, Al Newkirk.
This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.