GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Venus::Log(3) User Contributed Perl Documentation Venus::Log(3)

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. The default log level is trace. Acceptable log levels are "trace", "debug", "info", "warn", "error", and "fatal", and the set log level will handle events for its level and any preceding levels in the order specified.

This package has the following attributes:

  handler(coderef $code) (coderef)

The handler attribute holds the callback that handles logging. The handler is passed the log level and the log messages.

Since 1.68

handler example 1
  # given: synopsis
  package main;
  my $handler = $log->handler;
  my $events = [];
  $handler = $log->handler(sub{shift; push @$events, [@_]});
    

  level(string $name) (string)

The level attribute holds the current log level. Valid log levels are "trace", "debug", "info", "warn", "error" and "fatal", and will emit log messages in that order. Invalid log levels effectively disable logging.

Since 1.68

level example 1
  # 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.

Since 1.68

separator example 1
  # 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(string @data) (Venus::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(string @data) (Venus::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(string @data) (Venus::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(string @data) (Venus::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(string @data) (string)

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(string @data) (string)

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(any $data) (string)

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

Since 1.68

string example 1
  # given: synopsis
  package main;
  my $string = $log->string;
  # ""
    
string example 2
  # given: synopsis
  package main;
  my $string = $log->string('Something failed!');
  # "Something failed!"
    
string example 3
  # given: synopsis
  package main;
  my $string = $log->string([1,2,3]);
  # [1,2,3]
    
string example 4
  # given: synopsis
  package main;
  my $string = $log->string(bless({}));
  # "bless({}, 'main')"
    

  trace(string @data) (Venus::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(string @data) (Venus::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(string $level, any @data) (Venus::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('info', time, 'Something failed!');
  # bless(..., "Venus::Log")
    

Awncorp, "awncorp@cpan.org"

Copyright (C) 2022, Awncorp, "awncorp@cpan.org".

This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.

2023-11-27 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.