# See bottom of file for license and copyright information
package Foswiki::Configure::Checkers::WarningFileName;

use strict;
use warnings;

use Foswiki::Configure::Checker ();
our @ISA = ('Foswiki::Configure::Checker');

use Foswiki::Configure::Load ();

sub check_current_value {
    my ($this, $reporter) = @_;
    my $mess = '';

    if ( $Foswiki::cfg{WarningFileName} ) {

        # WARNING FIle is SET
        if (
            $Foswiki::cfg{Log}{Implementation} eq 'Foswiki::Logger::PlainFile' )
        {
            $reporter->ERROR(
                <<ERROR
WarningFileName is set, but your chosen logger is the PlainFile Logger, Foswiki will silently use the Compatibility logger.
Delete this setting to permit use of the PlainFileLogger.
ERROR
            );
        }
        elsif ( $Foswiki::cfg{Log}{Implementation} ne
            'Foswiki::Logger::Compatibility' )
        {
            $reporter->WARN(
'This setting is deprecated. Delete it unless you intend to use the CompatibilityLogger'
            );
        }
    }
    else {
        # WARNING FIle is NOT SET
        if ( $Foswiki::cfg{Log}{Implementation} eq
            'Foswiki::Logger::Compatibility' )
        {
            $reporter->WARN(
'This setting is recommended for the CompatibilityLogger.  If not set, logs are written to =$Foswiki::cfg{DataDir}/warn%DATE%.txt='
            );
        }
    }
}

1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/

Copyright (C) 2008-2012 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read LICENSE in the root of this distribution.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

As per the GPL, removal of this notice is prohibited.
