The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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

Mnet::Log::Conditional can be called to output log entries only if the Mnet::Log module has already been otherwise loaded.

This is 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 may want to do the same thing.

Refer to Mnet::Log for more information.

METHODS

Mnet::Log::Conditional implements the methods listed below.

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)

Output a debug entry using the Mnet::Log module, if loaed.

info

    $log->info($text)

Output an info entry using the Mnet::Log module, if loaed.

warn

    $log->warn($text)

Output a warn entry using the Mnet::Log module, if loaed.

fatal

    $log->fatal($text)

Output a fatal entry using the Mnet::Log module, if loaded.

FUNCTIONS

Mnet::Log::Conditional also implements the functions listed below.

DEBUG

    DEBUG($text)

Output a debug entry using the Mnet::Log module, if loaed.

INFO

    INFO($text)

Output an info entry using the Mnet::Log module, if loaed.

WARN

    WARN($text)

Output a warn entry using the Mnet::Log module, if loaed.

FATAL

    FATAL($text)

Output a fatal entry using the Mnet::Log module, if loaed.

SEE ALSO

Mnet

Mnet::Log

Mnet::Opts::Cli::Cache