Changeset 78

Show
Ignore:
Timestamp:
01.12.2006 23:32:57 (2 years ago)
Author:
decoder
Message:

Logging fixed (untested):

- Verbosity Level now applies ONLY to the logfile
- Errors and Warnings are always outputted to stderr (unless output to stderr is completely disabled)
- Debug and Info are only outputted to stderr if SA is in debug mode (-D)

Please keep it like that :)

Fix in Config.pm:

- get_mysql_ddb call moved inside if clause, otherwise you get a mysql warning even if you are not using mysql at all

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/devel/FuzzyOcr/Config.pm

    r75 r78  
    635635            } 
    636636        } 
    637         my $ddb = get_mysql_ddb(); 
    638         if ($conf->{focr_enable_image_hashing} == 3 and defined $ddb) { 
     637        if ($conf->{focr_enable_image_hashing} == 3 and defined (my $ddb = get_mysql_ddb())) { 
    639638            my $db   = $conf->{focr_mysql_db}; 
    640639            my $tab  = $conf->{focr_mysql_hash}; 
  • trunk/devel/FuzzyOcr/Logging.pm

    r77 r78  
    4646sub warnlog { 
    4747    my $conf = FuzzyOcr::Config::get_config(); 
    48     return if ($conf->{focr_verbose} < 1 and _not_debug()); 
    4948    _log("warn",$_[0]) if $conf->{focr_log_stderr}; 
    50     if (defined $conf->{focr_logfile}) { 
     49    if (defined $conf->{focr_logfile} and ($conf->{focr_verbose} < 1)) { 
    5150        logfile($_[0]); 
    5251    } 
     
    5554sub infolog { 
    5655    my $conf = FuzzyOcr::Config::get_config(); 
    57     return if ($conf->{focr_verbose} < 2 and _not_debug()); 
    58     _log("info",$_[0]) if $conf->{focr_log_stderr}; 
    59     if (defined $conf->{focr_logfile}) { 
     56    unless (_not_debug()) { 
     57        _log("info",$_[0]) if $conf->{focr_log_stderr}; 
     58    } 
     59    if (defined $conf->{focr_logfile} and ($conf->{focr_verbose} < 2)) { 
    6060        logfile($_[0]); 
    6161    } 
     
    6464sub debuglog { 
    6565    my $conf = FuzzyOcr::Config::get_config(); 
    66     return if ($conf->{focr_verbose} < 3 and _not_debug()); 
    67     _log("dbg",$_[0]) if $conf->{focr_log_stderr}; 
    68     if (defined $conf->{focr_logfile}) { 
     66    unless (_not_debug()) { 
     67        _log("dbg",$_[0]) if $conf->{focr_log_stderr}; 
     68    } 
     69    if (defined $conf->{focr_logfile} and ($conf->{focr_verbose} < 3)) { 
    6970        logfile($_[0]); 
    7071    }