NAME

Net::SolarWinds::LogMethods - Passive logging interfcaes

SYNOPSIS

package MyClass;

use base qw(Net::SolarWinds::ConstructorHash  Net::SolarWinds::LogMethods);

1;

my $pkg=new MyClass(key=>'value');

DESCRIPTION

This library provides a common logging interfcaes that expect Net::SolarWinds::Log or something that implements its features. It also assumes object instance is a hash with $self->{log} contains the logging object.

OO Methods provided

  • my $log=$self->get_log;

    Returns the logging object if any

  • $self->set_log(Net::SolarWinds::Log->new);

    Sets the Chater::Log object, you can also set this in the constructor at object creation time.

  • $self->log_error("Some error");

    This is a lazy man's wrapper function for

    my $log=$self->get_log;
    $log->log_error("Some error") if $log; 
  • $log->log_die("Log this and die");

    Logs the given message then dies.

  • $self->log_always("Some msg");

    This is a lazy man's wrapper function for

    my $log=$self->get_log;
    $log->log_always("Some msg") if $log; 
  • my $string=$self->log_header;

    This is a stub function that allows a quick addin for logging, the string returned will be inserted after the log_level in the log file if this function is created.

  • $self->log_warn("Some msg");

    This is a lazy man's wrapper function for:

    my $log=$self->get_log;
    $log->log_warn("Some msg") if $log; 
  • $self->log_info("Some msg");

    This is a lazy man's wrapper function for:

    my $log=$self->get_log;
    $log->log_info("Some msg") if $log; 
  • $self->log_debug("Some msg");

    This is a lazy man's wrapper function for:

    my $log=$self->get_log;
    $log->log_debug("Some msg") if $log; 

AUTHOR

Michael Shipper