File::Log

A simple Object Orientated Logger
Download

File::Log Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Greg George
  • Publisher web site:
  • http://search.cpan.org/~gng/

File::Log Tags


File::Log Description

A simple Object Orientated Logger File::Log is a Perl class providing methods to log data to a file. There are a number of parameters that can be passed to allow configuration of the logger.SYNOPSIS use File::Log; # Pretty format, all the parameters my $log = File::Log->new({ debug => 4, # Set the debug level logFileName => 'myLogFile.log', # define the log filename logFileMode => '>', # '>>' Append or '>' overwrite dateTimeStamp => 1, # Timestamp log data entries stderrRedirect => 1, # Redirect STDERR to the log file defaultFile => 1, # Use the log file as the default filehandle logFileDateTime => 1, # Timestamp the log filename appName => 'myApplicationName', # The name of the application PIDstamp => 1, # Stamp the log data with the Process ID storeExpText => 1, # Store internally all exp text msgprepend => '', # Text to prepend to each message say => 1, # msg() and exp() methode act like the perl6 say # command (default off) requested by Aaleem Jiwa # however it might be better to just use the say() # method }); # Minimal instance, logfile name based on application name my $log = File::Log->new(); # Typical usage, set the debug level and log filename (say from a config file) my $log = File::Log->new(debug => $debugLevel, logFileName => $logFileName,); # Print message to the log file if the debug is >= 2 $log->msg(2, "Add this to the log file if debug >= 2\n"); # Print message to the log file if the debug is >= 2 (but in a perl6 way) $log->say(2, "Add this to the log file if debug >= 2"); # Print an exception (error) message to the log file $log->exp("Something went wrong\n"); # Close the log file (optional at exit) $log->close(); # Change the debug level, capturing the old value $oldDebugValue = $log->debugValue($newDebugValue); $currentDebugValue = $log->debugValue(); # Get all the exceptions text (so you can do something with all the errors, eg email them) $allExceptions = $log->getExpText(); $numberErrors = $log->expCnt(); # How many times has $log->exp been called Requirements: · Perl What's New in This Release: · Updated Makefile.PL to include prereq for Encode as I was getting cpan tester errors. NO CODE CHANGES


File::Log Related Software