Venus::Log

Log Class

Log Class for Perl 5

method: debug method: error method: fatal method: info method: input method: output method: string method: trace method: warn method: write

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.

Venus::Kind::Utility

Venus::Role::Buildable

The handler attribute holds the callback that handles logging.

handler(CodeRef $code) (CodeRef)

{ since => '1.68', }

=example-1 handler

# given: synopsis

package main;

my $handler = $log->handler;

my $events = [];

$handler = $log->handler(sub{push @$events, [@_]});

The level attribute holds the current log level.

level(Str $name) (Str)

{ since => '1.68', }

=example-1 level

# given: synopsis

package main;

my $level = $log->level;

# "trace"

$level = $log->level('fatal');

# "fatal"

The separator attribute holds the value used to join multiple log message arguments.

separator(Any $data) (Any)

{ since => '1.68', }

=example-1 separator

# given: synopsis

package main;

my $separator = $log->separator;

# ""

$separator = $log->separator("\n");

# "\n"

The debug method logs debug information and returns the invocant.

debug(Str @data) (Log)

{ since => '1.68', }

=example-1 debug

# given: synopsis

package main;

# $log = $log->debug(time, 'Something failed!');

# "0000000000 Something failed!"

The error method logs error information and returns the invocant.

error(Str @data) (Log)

{ since => '1.68', }

=example-1 error

# given: synopsis

package main;

# $log = $log->error(time, 'Something failed!');

# "0000000000 Something failed!"

The fatal method logs fatal information and returns the invocant.

fatal(Str @data) (Log)

{ since => '1.68', }

=example-1 fatal

# given: synopsis

package main;

# $log = $log->fatal(time, 'Something failed!');

# "0000000000 Something failed!"

The info method logs info information and returns the invocant.

info(Str @data) (Log)

{ since => '1.68', }

=example-1 info

# given: synopsis

package main;

# $log = $log->info(time, 'Something failed!');

# "0000000000 Something failed!"

The input method returns the arguments provided to the log level methods, to the "output", and can be overridden by subclasses.

input(Str @data) (Str)

{ since => '1.68', }

=example-1 input

# given: synopsis

package main;

my @input = $log->input(1, 'Something failed!');

# (1, 'Something failed!')

The new method returns a new instance of this package.

new(Str $level | Any %args | HashRef $args) (Log)

{ since => '1.68', }

=example-1 new

package main;

use Venus::Log;

my $log = Venus::Log->new;

# bless(..., "Venus::Log")

# $log->level;

# "trace"

The output method returns the arguments returned by the "input" method, to the log handler, and can be overridden by subclasses.

output(Str @data) (Str)

{ since => '1.68', }

=example-1 output

# given: synopsis

package main;

my $output = $log->output(time, 'Something failed!');

# "0000000000 Something failed!"

The string method returns a stringified representation of any argument provided and is used by the "output" method.

string(Any $data) (Str)

{ since => '1.68', }

=example-1 string

# given: synopsis

package main;

my $string = $log->string;

# ""

The trace method logs trace information and returns the invocant.

trace(Str @data) (Log)

{ since => '1.68', }

=example-1 trace

# given: synopsis

package main;

# $log = $log->trace(time, 'Something failed!');

# "0000000000 Something failed!"

The warn method logs warn information and returns the invocant.

warn(Str @data) (Log)

{ since => '1.68', }

=example-1 warn

# given: synopsis

package main;

# $log = $log->warn(time, 'Something failed!');

# "0000000000 Something failed!"

The write method invokes the log handler, i.e. "handler", and returns the invocant.

write(Any @data) (Log)

{ since => '1.68', }

=example-1 write

# given: synopsis

package main;

# $log = $log->write(time, 'Something failed!');

# bless(..., "Venus::Log")

t/Venus.t: pdml: authors t/Venus.t: pdml: license

62 POD Errors

The following errors were encountered while parsing the POD:

Around line 13:

Unknown directive: =name

Around line 21:

Unknown directive: =tagline

Around line 29:

Unknown directive: =abstract

Around line 37:

Unknown directive: =includes

Around line 54:

Unknown directive: =synopsis

Around line 87:

Unknown directive: =description

Around line 95:

Unknown directive: =inherits

Around line 103:

Unknown directive: =integrates

Around line 111:

Unknown directive: =attribute

Around line 115:

Unknown directive: =signature

Around line 119:

Unknown directive: =metadata

Around line 147:

Unknown directive: =attribute

Around line 151:

Unknown directive: =signature

Around line 155:

Unknown directive: =metadata

Around line 185:

Unknown directive: =attribute

Around line 189:

Unknown directive: =signature

Around line 193:

Unknown directive: =metadata

Around line 223:

Unknown directive: =method

Around line 227:

Unknown directive: =signature

Around line 231:

Unknown directive: =metadata

Around line 274:

=cut found outside a pod block. Skipping to next block.

Around line 290:

Unknown directive: =method

Around line 294:

Unknown directive: =signature

Around line 298:

Unknown directive: =metadata

Around line 341:

=cut found outside a pod block. Skipping to next block.

Around line 357:

Unknown directive: =method

Around line 361:

Unknown directive: =signature

Around line 365:

Unknown directive: =metadata

Around line 408:

=cut found outside a pod block. Skipping to next block.

Around line 424:

Unknown directive: =method

Around line 428:

Unknown directive: =signature

Around line 432:

Unknown directive: =metadata

Around line 475:

=cut found outside a pod block. Skipping to next block.

Around line 491:

Unknown directive: =method

Around line 496:

Unknown directive: =signature

Around line 500:

Unknown directive: =metadata

Around line 526:

Unknown directive: =method

Around line 530:

Unknown directive: =signature

Around line 534:

Unknown directive: =metadata

Around line 579:

=cut found outside a pod block. Skipping to next block.

Around line 604:

=cut found outside a pod block. Skipping to next block.

Around line 615:

Unknown directive: =method

Around line 620:

Unknown directive: =signature

Around line 624:

Unknown directive: =metadata

Around line 650:

Unknown directive: =method

Around line 655:

Unknown directive: =signature

Around line 659:

Unknown directive: =metadata

Around line 695:

=cut found outside a pod block. Skipping to next block.

Around line 715:

=cut found outside a pod block. Skipping to next block.

Around line 735:

=cut found outside a pod block. Skipping to next block.

Around line 746:

Unknown directive: =method

Around line 750:

Unknown directive: =signature

Around line 754:

Unknown directive: =metadata

Around line 797:

=cut found outside a pod block. Skipping to next block.

Around line 813:

Unknown directive: =method

Around line 817:

Unknown directive: =signature

Around line 821:

Unknown directive: =metadata

Around line 864:

=cut found outside a pod block. Skipping to next block.

Around line 880:

Unknown directive: =method

Around line 884:

Unknown directive: =signature

Around line 888:

Unknown directive: =metadata

Around line 921:

Unknown directive: =partials