Fault::Delegate::Stdout - Print logger delegate.


Fault documentation  | view source Contained in the Fault distribution.

Index


NAME

Top

 Fault::Delegate::Stdout - Print logger delegate.

SYNOPSIS

Top

 use Fault::Delegate::Stdout;
 $self = Fault::Delegate::Stdout->new;
 $okay = $self->log ($msg);
 $bool = $self->test;

Inheritance

Top

 UNIVERSAL
   Fault::Delegate
     Fault::Delegate::Stdout

Description

Top

This is a Logger delegate that writes all the log messages to stdout. It is Logger's default delegate if no other is given. It is also a pretty good one to start with when you are trying to understand how this system works.

It satisfies the absolute minimum requirements of the Fault::Delegate logger delegate protocol.

Examples

Top

 use Fault::Delegate::Stdout;
 use Fault::Logger;
 use Fault::Msg;

 my $msg       = Fault::Msg                   ("Arf!");
 my $baz       = Fault::Delegate::Stdout->new ("/tmp/mylogfile");
 my $waslogged = $baz->log                    ($msg);

                 Fault::Logger->new           ($baz);
 my $waslogged = Fault::Logger->log           ("Bow! Wow!");

Instance Variables

Top

None.

Class Methods

Top

$delegate = Fault::Delegate::Stdout->new

Create a logger delegate object that prints log messages to stdout. Prints a warning message and returns undef on failure.

Logger Protocol Instance Methods

Top

$okay = $self->log ($msg)

Print a time-stamped message to stdout using information taken from Fault::Msg object $msg in the format:

      $date $time UTC> $process: $type($priority): $msg\n

for example:

      20021207 223010 UTC> MyProcess: NOTE(notice): Nothing happened today.\n

Return true if the message was printed.

Private Class Methods

Top

None.

Private Instance Methods

Top

$bool = $self->test

If the debug level has been set to at least one in Fault::DebugPrinter, it executes the test method of the parent, Fault::Delegate class. Otherwise it always returns true. This was added so that an annoying initial message from the Fault system will not be printed on a terminal unless it is actually wanted for debugging purposees.

$bool = $self->test

Executes a _connect, a log write and a _disconnect. It returns true if this succeeds. This is useful in personalized subclass new methods.

$bool = $self->_write ($msg)

Impliments the above override to the internal family protocol utilized by the Fault:Delegate log and test methods.

Errors and Warnings

Top

Local warning messages are issued if the sys logger cannot be reached or has any problems whatever.

KNOWN BUGS

Top

 See TODO.

SEE ALSO

Top

Fault::Logger, Fault::Delegate, Fault::Msg

AUTHOR

Top

Dale Amon <amon@vnl.com>


Fault documentation  | view source Contained in the Fault distribution.