Skip to content
ggodart edited this page Jan 4, 2021 · 5 revisions

Logger

See original

SYNOPSIS

  $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 );

DESCRIPTION

A convenience class for logging messages. To change the logging level call set(...) on this object with one of the following possible states: 'fatal', 'error', 'warn', 'info', 'debug', and 'trace'.

INHERITS

Generic_Item

INI PARAMETERS

None

METHODS

Method Description
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 );

AUTHOR

SEE ALSO

None

Clone this wiki locally