############################################################################## # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library 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 # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/ # ############################################################################## package Net::XMPP::Debug; =head1 NAME Net::XMPP::Debug - XMPP Debug Module =head1 SYNOPSIS Net::XMPP::Debug is a module that provides a developer easy access to logging debug information. =head1 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. =head2 Basic Functions $Debug = Net::XMPP::Debug->new(); $Debug->Init( level => 2, file => "stdout", header =>"MyScript"); $Debug->Log0("Connection established"); =head1 METHODS =head2 Basic Functions =over 4 =item new new(hash) creates the Debug object. The hash argument is passed to the Init function. See that function description below for the valid settings. =item Init Init( level => integer, file => string, header => string, setdefault => 0|1, usedefault => 0|1, time => 0|1) initializes the debug object. The B determines the maximum level of debug messages to log: 0 - Base level Output (default) 1 - High level API calls 2 - Low level API calls ... N - Whatever you want.... The B 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. B
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"). B saves the current filehandle and makes it available for other Debug objects to use. To use the default set B to 1. The B