NAME
Mnet::Log::Conditional - Use Mnet::Log if Mnet::Log is loaded
SYNOPSIS
use Mnet::Log::Conditional qw( DEBUG INFO WARN FATAL );
# nothing will happen unless Mnet::Log was loaded
INFO("starting");
# errors will still always go to stderr
WARN("error");
FATAL("abort");
my $log = Mnet::Log::Conditional->new($opts);
$log->DEBUG("object oriented interace");
DESCRIPTION
This module can be called to output log entries using the Mnet::Log module, but only if the Mnet::Log module has already been loaded.
This is module used by other Mnet modules for logging, so that they generate log output only if the calling script is using the Mnet::Log module. Users who create custom modules that expand on included Mnet modules may want to do the same thing.
Refer to perldoc Mnet::Log for more information.
new
$log = Mnet::Log::Conditional->new(\%opts)
This class method creates a new Mnet::Log::Conditional object. The opts hash ref argument is not requried but may be used to override any parsed cli options parsed with the Mnet::Opts::Cli module.
The returned object may be used to call other documented functions and methods in this module, which will call the Mnet::Log module if it is loaded.
Refer to the new method in perldoc Mnet::Log for more information.
debug
$log->debug($text)
Method to output a debug entry using the Mnet::Log module, if it is loaed. If the Mnet::Log module is not loaded then nothing happens.
info
$log->info($text)
Method to output an info entry using the Mnet::Log module, if it is loaed. If the Mnet::Log module is not loaded then nothing happens.
warn
$log->warn($text)
Method to output a warn entry using the Mnet::Log module, if it is loaed. If the Mnet::Log module is not loaded then the perl warn command is called.
fatal
$log->fatal($text)
Method to output a fatal entry using the Mnet::Log module, if it is loaded. If the Mnet::Log module is not loaded then the perl die command is called.
DEBUG
DEBUG($text)
Function to output a debug entry using the Mnet::Log module, if it is loaed. If the Mnet::Log module is not loaded then nothing happens.
INFO
INFO($text)
Function to output an info entry using the Mnet::Log module, if it is loaed. If the Mnet::Log module is not loaded then nothing happens.
WARN
WARN($text)
Function to output a debug entry using the Mnet::Log module, if it is loaed. If the Mnet::Log module is not loaded then the perl warn command is called.
FATAL
FATAL($text)
Function to output a debug entry using the Mnet::Log module, if it is loaed. If the Mnet::Log module is not loaded then the perl die command is called.