NAME
Venus::Log - Log Class
ABSTRACT
Log Class for Perl 5
SYNOPSIS
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!"
DESCRIPTION
This package provides methods for logging information using various log levels.
ATTRIBUTES
This package has the following attributes:
handler
handler(CodeRef $code) (CodeRef)
The handler attribute holds the callback that handles logging.
Since 1.68
- handler example 1
-
# given: synopsis package main; my $handler = $log->handler; my $events = []; $handler = $log->handler(sub{push @$events, [@_]});
level
level(Str $name) (Str)
The level attribute holds the current log level.
Since 1.68
- level example 1
-
# given: synopsis package main; my $level = $log->level; # "trace" $level = $log->level('fatal'); # "fatal"
separator
separator(Any $data) (Any)
The separator attribute holds the value used to join multiple log message arguments.
Since 1.68
- separator example 1
-
# given: synopsis package main; my $separator = $log->separator; # "" $separator = $log->separator("\n"); # "\n"
INHERITS
This package inherits behaviors from:
INTEGRATES
This package integrates behaviors from:
METHODS
This package provides the following methods:
debug
debug(Str @data) (Log)
The debug method logs debug
information and returns the invocant.
Since 1.68
- debug example 1
-
# given: synopsis package main; # $log = $log->debug(time, 'Something failed!'); # "0000000000 Something failed!"
- debug example 2
-
# given: synopsis package main; # $log->level('info'); # $log = $log->debug(time, 'Something failed!'); # noop
error
error(Str @data) (Log)
The error method logs error
information and returns the invocant.
Since 1.68
- error example 1
-
# given: synopsis package main; # $log = $log->error(time, 'Something failed!'); # "0000000000 Something failed!"
- error example 2
-
# given: synopsis package main; # $log->level('fatal'); # $log = $log->error(time, 'Something failed!'); # noop
fatal
fatal(Str @data) (Log)
The fatal method logs fatal
information and returns the invocant.
Since 1.68
- fatal example 1
-
# given: synopsis package main; # $log = $log->fatal(time, 'Something failed!'); # "0000000000 Something failed!"
- fatal example 2
-
# given: synopsis package main; # $log->level('unknown'); # $log = $log->fatal(time, 'Something failed!'); # noop
info
info(Str @data) (Log)
The info method logs info
information and returns the invocant.
Since 1.68
- info example 1
-
# given: synopsis package main; # $log = $log->info(time, 'Something failed!'); # "0000000000 Something failed!"
- info example 2
-
# given: synopsis package main; # $log->level('warn'); # $log = $log->info(time, 'Something failed!'); # noop
input
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.
Since 1.68
- input example 1
-
# given: synopsis package main; my @input = $log->input(1, 'Something failed!'); # (1, 'Something failed!')
output
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.
Since 1.68
- output example 1
-
# given: synopsis package main; my $output = $log->output(time, 'Something failed!'); # "0000000000 Something failed!"
string
string(Any $data) (Str)
The string method returns a stringified representation of any argument provided and is used by the "output" method.
Since 1.68
- string example 2
-
# given: synopsis package main; my $string = $log->string('Something failed!'); # "Something failed!"
- string example 4
-
# given: synopsis package main; my $string = $log->string(bless({})); # "bless({}, 'main')"
trace
trace(Str @data) (Log)
The trace method logs trace
information and returns the invocant.
Since 1.68
- trace example 1
-
# given: synopsis package main; # $log = $log->trace(time, 'Something failed!'); # "0000000000 Something failed!"
- trace example 2
-
# given: synopsis package main; # $log->level('debug'); # $log = $log->trace(time, 'Something failed!'); # noop
warn
warn(Str @data) (Log)
The warn method logs warn
information and returns the invocant.
Since 1.68
- warn example 1
-
# given: synopsis package main; # $log = $log->warn(time, 'Something failed!'); # "0000000000 Something failed!"
- warn example 2
-
# given: synopsis package main; # $log->level('error'); # $log = $log->warn(time, 'Something failed!'); # noop
write
write(Any @data) (Log)
The write method invokes the log handler, i.e. "handler", and returns the invocant.
Since 1.68
- write example 1
-
# given: synopsis package main; # $log = $log->write(time, 'Something failed!'); # bless(..., "Venus::Log")
AUTHORS
Awncorp, awncorp@cpan.org
LICENSE
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.