LWP::Debug(3) User Contributed Perl Documentation LWP::Debug(3)NAME
LWP::Debug - debug routines for the libwww-perl library
SYNOPSIS
use LWP::Debug qw(+ -conns);
# Used internally in the library
LWP::Debug::trace('send()');
LWP::Debug::debug('url ok');
LWP::Debug::conns("read $n bytes: $data");
DESCRIPTION
LWP::Debug provides tracing facilities. The trace(), debug() and conns() function are called within the library and they log information at
increasing levels of detail. Which level of detail is actually printed is controlled with the "level()" function.
The following functions are available:
level(...)
The "level()" function controls the level of detail being logged. Passing '+' or '-' indicates full and no logging respectively. Inidi-
vidual levels can switched on and of by passing the name of the level with a '+' or '-' prepended. The levels are:
trace : trace function calls
debug : print debug messages
conns : show all data transfered over the connections
The LWP::Debug module provide a special import() method that allows you to pass the level() arguments with initial use statement. If a
use argument start with '+' or '-' then it is passed to the level function, else the name is exported as usual. The following two
statements are thus equivalent (if you ignore that the second pollutes your namespace):
use LWP::Debug qw(+);
use LWP::Debug qw(level); level('+');
trace($msg)
The "trace()" function is used for tracing function calls. The package and calling subroutine name is printed along with the passed
argument. This should be called at the start of every major function.
debug($msg)
The "debug()" function is used for high-granularity reporting of state in functions.
conns($msg)
The "conns()" function is used to show data being transferred over the connections. This may generate considerable output.
libwww-perl-5.65 1997-12-02 LWP::Debug(3)
Check Out this Related Man Page
Net::XMPP::Debug(3) User Contributed Perl Documentation Net::XMPP::Debug(3)NAME
Net::XMPP::Debug - XMPP Debug Module
SYNOPSIS
Net::XMPP::Debug is a module that provides a developer easy access
to logging debug information.
DESCRIPTION
Debug is a helper module for the Net::XMPP modules. It provides
the Net::XMPP modules with an object to control where, how, and
what is logged.
Basic Functions
$Debug = new Net::XMPP::Debug();
$Debug->Init(level=>2,
file=>"stdout",
header=>"MyScript");
$Debug->Log0("Connection established");
METHODS
Basic Functions
new(hash) - creates the Debug object. The hash argument is passed
to the Init function. See that function description
below for the valid settings.
Init(level=>integer, - initializes the debug object. The level
file=>string, determines the maximum level of debug
header=>string, messages to log:
setdefault=>0|1, 0 - Base level Output (default)
usedefault=>0|1, 1 - High level API calls
time=>0|1) 2 - Low level API calls
...
N - Whatever you want....
The file determines where the debug log
goes. You can either specify a path to
a file, or "stdout" (the default). "stdout"
tells Debug to send all of the debug info
sent to this object to go to stdout.
header is a string that will preappended
to the beginning of all log entries. This
makes it easier to see what generated the
log entry (default is "Debug").
setdefault saves the current filehandle
and makes it available for other Debug
objects to use. To use the default set
usedefault to 1. The time parameter
specifies whether or not to add a timestamp
to the beginning of each logged line.
LogN(array) - Logs the elements of the array at the corresponding
debug level N. If you pass in a reference to an
array or hash then they are printed in a readable
way. (ie... Log0, Log2, Log100, etc...)
EXAMPLE
$Debug = new Net::XMPP:Debug(level=>2,
header=>"Example");
$Debug->Log0("test");
$Debug->Log2("level 2 test");
$hash{a} = "atest";
$hash{b} = "btest";
$Debug->Log1("hashtest",\%hash);
You would get the following log:
Example: test
Example: level 2 test
Example: hashtest { a=>"atest" b=>"btest" }
If you had set the level to 1 instead of 2 you would get:
Example: test
Example: hashtest { a=>"atest" b=>"btest" }
AUTHOR
Ryan Eatmon
COPYRIGHT
This module is free software, you can redistribute it and/or modify it under the LGPL.
perl v5.12.1 2010-07-05 Net::XMPP::Debug(3)