my $log_file = $fileroot . $dot . "LOG";
if ($logfile_stream) { $log_file = $logfile_stream }
+ # The logger object handles warning messages, logfile messages,
+ # and can supply basic run information to lower level routines.
my $logger_object = Perl::Tidy::Logger->new(
rOpts => $rOpts,
log_file => $log_file,
#####################################################################
#
-# The Perl::Tidy::Logger class writes the .LOG and .ERR files
+# The Perl::Tidy::Logger class writes any .LOG and .ERR files
+# and supplies some basic run information for error handling.
#
#####################################################################
_warning_count => 0,
_complaint_count => 0,
_is_encoded_data => $is_encoded_data,
- _saw_code_bug => -1, # -1=no 0=maybe 1=for sure
+ _saw_code_bug => -1, # -1=no 0=maybe 1=for sure
_saw_brace_error => 0,
_output_array => [],
_input_stream_name => $input_stream_name,
_filename_stamp => $filename_stamp,
+ _save_logfile => $rOpts->{'logfile'},
}, $class;
}
sub get_save_logfile {
- # To be called after tokenizer has finished to make formatting more
- # efficient.
- my $self = shift;
- my $saw_code_bug = $self->{_saw_code_bug};
- my $rOpts = $self->{_rOpts};
- return $saw_code_bug == 1 || $rOpts->{'logfile'};
+ # Returns a true/false flag indicating whether or not
+ # the logfile will be saved.
+ my $self = shift;
+ return $self->{_save_logfile};
}
sub finish {
# called after all formatting to summarize errors
my ($self) = @_;
- my $rOpts = $self->{_rOpts};
my $warning_count = $self->{_warning_count};
my $saw_code_bug = $self->{_saw_code_bug};
+ my $save_logfile = $self->{_save_logfile};
+ my $log_file = $self->{_log_file};
- my $save_logfile = $saw_code_bug == 1
- || $rOpts->{'logfile'};
- my $log_file = $self->{_log_file};
if ($warning_count) {
if ($save_logfile) {
$self->block_log_output(); # avoid echoing this to the logfile