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:
#
# VERSION: 1.0
#
##############################################################################
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;