.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Net::XMPP::Debug 3pm" .TH Net::XMPP::Debug 3pm 2025-12-14 "perl v5.42.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Net::XMPP::Debug \- XMPP Debug Module .SH SYNOPSIS .IX Header "SYNOPSIS" Net::XMPP::Debug is a module that provides a developer easy access to logging debug information. .SH DESCRIPTION .IX Header "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. .SS "Basic Functions" .IX Subsection "Basic Functions" .Vb 1 \& $Debug = Net::XMPP::Debug\->new(); \& \& $Debug\->Init( \& level => 2, \& file => "stdout", \& header =>"MyScript"); \& \& $Debug\->Log0("Connection established"); .Ve .SH METHODS .IX Header "METHODS" .SS "Basic Functions" .IX Subsection "Basic Functions" .IP new 4 .IX Item "new" .Vb 1 \& new(hash) .Ve .Sp creates the Debug object. The hash argument is passed to the Init function. See that function description below for the valid settings. .IP Init 4 .IX Item "Init" .Vb 7 \& Init( \& level => integer, \& file => string, \& header => string, \& setdefault => 0|1, \& usedefault => 0|1, \& time => 0|1) .Ve .Sp initializes the debug object. .Sp The \fBlevel\fR determines the maximum level of debug messages to log: .Sp .Vb 5 \& 0 \- Base level Output (default) \& 1 \- High level API calls \& 2 \- Low level API calls \& ... \& N \- Whatever you want.... .Ve .Sp The \fBfile\fR 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. .Sp \&\fBheader\fR 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"). .Sp \&\fBsetdefault\fR saves the current filehandle and makes it available for other Debug objects to use. To use the default set \&\fBusedefault\fR to 1. .Sp The \fBtime\fR parameter specifies whether or not to add a timestamp to the beginning of each logged line. .IP LogN 4 .IX Item "LogN" .Vb 1 \& LogN(array) .Ve .Sp 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...) .SH EXAMPLE .IX Header "EXAMPLE" .Vb 2 \& $Debug = Net::XMPP:Debug\->new(level=>2, \& header=>"Example"); \& \& $Debug\->Log0("test"); \& \& $Debug\->Log2("level 2 test"); \& \& $hash{a} = "atest"; \& $hash{b} = "btest"; \& \& $Debug\->Log1("hashtest", \e%hash); .Ve .PP You would get the following log: .PP .Vb 3 \& Example: test \& Example: level 2 test \& Example: hashtest { a=>"atest" b=>"btest" } .Ve .PP If you had set the level to 1 instead of 2 you would get: .PP .Vb 2 \& Example: test \& Example: hashtest { a=>"atest" b=>"btest" } .Ve .SH AUTHOR .IX Header "AUTHOR" Originally authored by Ryan Eatmon. .PP Previously maintained by Eric Hacker. .PP Currently maintained by Darian Anthony Patrick. .SH COPYRIGHT .IX Header "COPYRIGHT" This module is free software, you can redistribute it and/or modify it under the LGPL 2.1.