Dominique Dumont

NAME

Puppet::LogBody - Log facility

SYNOPSIS

 use Puppet::LogBody ;

 my $log = new Puppet::LogBody 
  ( 
   name => 'log test', 
   'how' => 'print'
  ) ;

 $log -> log("hello")  ;                 # printed on STDOUT
 $log -> log("world",'how' => 'warn')  ; # printed on STDERR

 my @a = $log-> getAll() ; # @a contains ['hello','world']

DESCRIPTION

This class implements a log facility which can either print on STDOUT or warn on STDERR (or hide) the log message. But in any case, the log message will be stored in the class so that all log messages can be retrieved later by the user.

Constructor

new (...)

Creates the log object.

Parameters are

  • name: is the log name that will be printed on STDERR or STDOUT at each log. (optional)

  • how: specifies what to do when a log is sent to the object (either print on STDOUT, warn on STDERR). By default the logs will not be printed or warned.

For instance if name is set to 'foo' a call to log('hello') will print:

 foo:
       hello

Methods

As Puppet::LogBody inherits from Puppet::Log, all the parent methods are available.

log(text,...)

Will log the passed text

Optional parameters are:

  • how: will supersede the 'how' parameter passed to the constructor. If 'how' is set to undef, the log will not be printed or warned.

clear()

Clear all stored logs

getAll()

Return an array made of all stored logs.

About Puppet body classes

Puppet classes are a set of utility classes which can be used by any object. If you use directly the Puppet::*Body class, you get the plain functionnality. And if you use the Puppet::* class, you can get the same functionnality and a Tk Gui to manage it.

AUTHOR

Dominique Dumont, ddumont at cpan dot org.

Copyright (c) 1998-1999,2007 Dominique Dumont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1), Puppet::Log(3)