Net::Peep::Log |
Net::Peep::Log - Perl extension for client-side logging and debugging for Peep: The Network Auralizer.
This module is a part of Peep.
use Net::Peep::Log; my $log = new Net::Peep::Log;
$log->log("Hello"," World!");
$Net::Peep::Log::logfile = '/var/log/peep/client.log'; $Net::Peep::Log::debug = 3;
my $object = new Some::Object; $log->mark("foomark"); $object->foo(); $log->log("The method foo took ",$log->benchmark("foomark")," seconds."); $log->mark("barmark"); $object->bar(); $log->log("The method bar took ",$log->benchmark("foomark")," seconds and ", "foo and bar took a total of ",$log->benchmark("barmark"));
$log->debug(1,"This message will be logged in ", "/var/log/peep/client.log");
$log->debug(4,"This message will not be logged in ", "/var/log/peep/client.log");
Net::Peep::Log provides methods for writing logging and debugging messages.
Messages are written to the file defined by the class attribute $Net::Peep::Log::logfile. If the attribute is not defined, messages are written to standard error.
All messages are prepended with a syslog-style time stamp.
Debugging messages are accompanied with an argument specifying the debugging level of the message. The class attribute $Net::Peep::Log::debug defines the cutoff level for debugging messages to appear in the log.
If the debugging level of a particular debugging message is compared with the global debugging level. If it is less than or equal to the global debugging level, it is logged. Otherwise, it is discarded.
The default value of $Net::Peep::Log::debug is 0.
This provides the coder with the ability to specify how much debugging output to include in client output by simply setting the $Net::Peep::Log::debug level.
Generally accepted categories associated with various debugging levels are as follows:
0 - No debugging output 1 - Configuration debugging and output and command-line option parsing 3 - General operational information 5 - Log parsing and rule (e.g., event) recognition 7 - Socket binding and client-server interaction 9 - The works. Whoa Nelly. Watch out.
None by default.
$Net::Peep::Log::VERSION - The CVS revision of this module.
The following class attributes are optional:
$Net::Peep::Log::logfile $Net::Peep::Log::debug - The debug level. Default: 0.
If no logfile is specified, log output is sent to STDOUT and debugging output is sent to STDERR.
If a logfile is specified, both log output and debugging output are sent to the logfile.
new() - Net::Peep::Log constructor.
log($message1,$message2,...) - Prints a log message. All log messages are prepended with a syslog-style time stamp and appended with a newline.
debug($debuglevel,$message1,$message2,...) - Prints a debugging message. All debugging message are prepended with a syslog-style time stamp and appended with a newline. Information regarding the debug level is given above.
mark($identifier) - Starts marking time based on identifier $identifier. Prints a log message to that effect.
benchmark($identifier) - Evaluates the number of microseconds since the mark corresponding to identifier $identifier was set and prints a log message. Returns the number of seconds accurate to the microsecond.
Collin Starkweather <collin.starkweather@collinstarkweather.com> Copyright (C) 2001
perl(1), peepd(1), Net::Peep::BC, Net::Peep::Parse, logparser, sysmonitor.
You should have received a file COPYING containing license terms along with this program; if not, write to Michael Gilfix (mgilfix@eecs.tufts.edu) for a copy.
This version of Peep is open source; you can redistribute it and/or modify it under the terms listed in the file COPYING.
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.
$Log: Net::Peep::Log.html,v $
Revision 1.1 2001/04/23 10:19:14 starky
Commit in preparation for release 0.4.1.
o Altered package namespace of Peep clients to Net::Peep
at the suggestion of a CPAN administrator.
o Changed Peep::Client::Log to Net::Peep::Client::Logparser
and Peep::Client::System to Net::Peep::Client::Sysmonitor
for clarity.
o Made adjustments to documentation.
o Fixed miscellaneous bugs.
Revision 1.3 2001/03/31 07:51:35 mgilfix
Last major commit before the 0.4.0 release. All of the newly rewritten clients and libraries are now working and are nicely formatted. The server installation has been changed a bit so now peep.conf is generated from the template file during a configure - which brings us closer to having a work-out-of-the-box system.
Revision 1.3 =head1 CHANGE LOG
$Log: Net::Peep::Log.html,v $ Revision 1.1 2001/04/23 10:19:14 starky Commit in preparation for release 0.4.1. o Altered package namespace of Peep clients to Net::Peep at the suggestion of a CPAN administrator. o Changed Peep::Client::Log to Net::Peep::Client::Logparser and Peep::Client::System to Net::Peep::Client::Sysmonitor for clarity. o Made adjustments to documentation. o Fixed miscellaneous bugs. Revision 1.3 2001/03/31 07:51:35 mgilfix
Last major commit before the 0.4.0 release. All of the newly rewritten clients and libraries are now working and are nicely formatted. The server installation has been changed a bit so now peep.conf is generated from the template file during a configure - which brings us closer to having a work-out-of-the-box system.
Revision 1.3 2001/03/31 02:17:00 mgilfix Made the final adjustments to for the 0.4.0 release so everything now works. Lots of changes here: autodiscovery works in every situation now (client up, server starts & vice-versa), clients now shutdown elegantly with a SIGTERM or SIGINT and remove their pidfiles upon exit, broadcast and server definitions in the class definitions is now parsed correctly, the client libraries now parse the events so they can translate from names to internal numbers. There's probably some other changes in there but many were made :) Also reformatted all of the code, so it uses consistent indentation.
Revision 1.2 2001/03/30 18:34:12 starky Adjusted documentation and made some modifications to Peep::BC to handle autodiscovery differently. This is the last commit before the 0.4.0 release.
Revision 1.1 2001/03/28 00:33:59 starky Adding the Peep::Log module for the first time. I can't believe I forgot to add this earlier. Doh!
Net::Peep::Log |