Net::SolarWinds::LogMethods - Passive logging interfcaes
package MyClass; use base qw(Net::SolarWinds::ConstructorHash Net::SolarWinds::LogMethods); 1; my $pkg=new MyClass(key=>'value');
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.
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");
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");
my $log=$self->get_log; $log->log_info("Some msg") if $log;
$self->log_debug("Some msg");
my $log=$self->get_log; $log->log_debug("Some msg") if $log;
Michael Shipper
To install Net::SolarWinds::REST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SolarWinds::REST
CPAN shell
perl -MCPAN -e shell install Net::SolarWinds::REST
For more information on module installation, please visit the detailed CPAN module installation guide.