package logdiff;

BEGIN {
    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
    die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
}

use util;
use diffutil;
use Text::Diff;

sub test_log
{
    my ($full_mlog_dir, $full_tlog_dir) = @_;

    my @mlog_files = &diffutil::files_in_dir($full_mlog_dir);
    my @tlog_files = &diffutil::files_in_dir($full_tlog_dir);

    my $full_mlog_file = &util::filename_cat($full_mlog_dir,$mlog_files[scalar(@mlog_files)-1]);
    my $full_tlog_file = &util::filename_cat($full_tlog_dir,$tlog_files[scalar(@tlog_files)-1]);
    my $test_result = diff $full_mlog_file, $full_tlog_file, { STYLE => "Table" };
    if(!($test_result eq ""))
    {
	return "Difference Report: $test_result";
    }
    else
    {
	return "";
    }
}

1;
