Changeset 6495 for trunk/core/lib/Foswiki/Logger/PlainFile.pm
- Timestamp:
- 02/23/10 12:46:38 (3 years ago)
- File:
-
- 1 edited
-
trunk/core/lib/Foswiki/Logger/PlainFile.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki/Logger/PlainFile.pm
r4898 r6495 18 18 19 19 This logger implementation maps groups of levels to a single logfile, viz. 20 * =debug= messages are output to $Foswiki::cfg{ DebugFileName}21 * =info= messages are output to $Foswiki::cfg{Log FileName}20 * =debug= messages are output to $Foswiki::cfg{Log}{Dir}/debug%DATE%.log 21 * =info= messages are output to $Foswiki::cfg{Log}{Dir}/log%DATE%.log 22 22 * =warning=, =error=, =critical=, =alert=, =emergency= messages are 23 output to $Foswiki::cfg{ WarningFileName}.23 output to $Foswiki::cfg{Log}{Dir}/warn%DATE%.log. 24 24 * =error=, =critical=, =alert=, and =emergency= messages are also 25 25 written to standard error (the webserver log file, usually) … … 29 29 use Foswiki::Time (); 30 30 use Foswiki::ListIterator (); 31 32 # Map from a log level to the root of a log file name 33 our %LEVEL2LOG = ( 34 debug => 'debug', 35 info => 'events', 36 warning => 'error', 37 error => 'error', 38 critical => 'error', 39 alert => 'error', 40 emergency => 'error' 41 ); 31 42 32 43 # Local symbol used so we can override it during unit testing … … 67 78 } 68 79 else { 80 # die to force the admin to get permissions correct 69 81 die 'ERROR: Could not write ' . $message . ' to ' . "$log: $!\n"; 70 82 } … … 192 204 sub _getLogForLevel { 193 205 my $level = shift; 194 my $log; 195 if ( $level eq 'debug' ) { 196 $log = $Foswiki::cfg{DebugFileName}; 197 } 198 elsif ( $level eq 'info' ) { 199 $log = $Foswiki::cfg{LogFileName}; 200 } 201 else { 202 ASSERT( $level =~ /^(warning|error|critical|alert|emergency)$/ ) 203 if DEBUG; 204 $log = $Foswiki::cfg{WarningFileName}; 205 } 206 return $log; 206 ASSERT(defined $LEVEL2LOG{$level}) if DEBUG; 207 my $log = $LEVEL2LOG{$level}; 208 return "$Foswiki::cfg{Log}{Dir}/$log%DATE%.log"; 207 209 } 208 210 … … 211 213 Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/ 212 214 213 Copyright (C) 2008-20 09Foswiki Contributors. Foswiki Contributors215 Copyright (C) 2008-2010 Foswiki Contributors. Foswiki Contributors 214 216 are listed in the AUTHORS file in the root of this distribution. 215 217 NOTE: Please extend that file, not this notice.
Note: See TracChangeset
for help on using the changeset viewer.
