package Util::NoLog; ############################################################################## # # DESCRIPTION: This is a simple replacement for Util::Log which simply # DESCRIPTION: prints output to stdout/stderr. Unlike Util::Log it has no # DESCRIPTION: internal state, so you may create as many of them as you like # DESCRIPTION: during a processing run. The main use for this class is for # DESCRIPTION: issuing errors during initialization when the Util::Log # DESCRIPTION: object has not yet been created. # # HISTORY # HISTORY: $Log: NoLog.pm,v $ # HISTORY: Revision 1.3 2014/02/27 07:01:07 apsop # HISTORY: VERSION header now shows CVS Revision # HISTORY: # HISTORY: Revision 1.2 2006/08/01 20:35:34 apsop # HISTORY: Add in CVS history indicator. # HISTORY: # HISTORY: # # VERSION: $Revision: 1.3 $ # ############################################################################## use strict; sub new { my $proto = shift; my $class = ref($proto) || $proto; my $filename = shift; my $self={}; bless($self,$class); return $self; } # end of constructor ############################# # METHODS: ############################# ############################ # give a message to stdout ############################ sub entry { my $self = shift; my $message=shift; print STDOUT "$message\n"; } ########################################################### # give a message to stdout with some dramatic decoration ########################################################### sub milestone { my $self = shift; my $message=shift; print STDOUT "---------------------------------------------------------\n"; print STDOUT "$message\n"; } ########################################################################### # signal an error to stderr ########################################################################### sub error { my $self = shift; my $level=shift; my $message=shift; print STDERR "E$level: $message\n"; } ################################################### # method to dump the contents of a file to stdout ################################################### sub file { my $self=shift; my $file=shift; if( ! open(FILE, "<$file") ) { $self->error(2,"Could not dump file $file to log"); return; } while (<FILE>) { print } close FILE; print "\n\n"; } ################################################### # method to dump the contents of a string to stdout. ################################################### sub text { my $self=shift; my $text=shift; print $text; print "\n\n"; } 1;