Logger.pm |
$kitchen_log = new Logger();
$kitchen_log->set('warn'); # Can be set via web, telnet, voice, etc.
$kitchen_log->fatal('print a fatal msg'); # prints
$kitchen_log->error('print an error msg'); # prints
$kitchen_log->warn('print a warning msg'); # prints
$kitchen_log->info('print an info msg'); # does not print
$kitchen_log->debug('print a debug msg'); # does not print
$kitchen_log->trace('print a trace msg'); # does not print
If you would like you own custom output, then change print_expression. The default print_expression is
my $tmp = $self->get_object_name();
$tmp =~ s/(_logger|_log)$//i;
&main::print_log( $tmp . ' [' . $level . '] ' . $msg );
A convenience class for logging messages. To change the loggging level call set(...) on this object with one of the following possible states: 'fatal', 'error', 'warn', 'info', 'debug', and 'trace'.
Generic_Item
new
Creates a new Logger class. $p_name - optional argument to easily set $$self{object_name}
print_expression
This can be set to have your own custom expression to print. This can include writing to a file or whatever you want.
Available Variables:
$self - the logger
$msg - the message to be printed
$level - the logged message level of severity (error, debug, trace, etc)
Default Value:
my $tmp = $self->get_object_name();
$tmp =~ s/(_logger|_log)$//i;
&main::print_log( $tmp . ' [' . $level . '] ' . $msg );
NONE
UNK
NONE
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.
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. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Logger.pm |