1Net::XMPP::Debug(3) User Contributed Perl Documentation Net::XMPP::Debug(3)
2
3
4
6 Net::XMPP::Debug - XMPP Debug Module
7
9 Net::XMPP::Debug is a module that provides a developer easy access
10 to logging debug information.
11
13 Debug is a helper module for the Net::XMPP modules. It provides
14 the Net::XMPP modules with an object to control where, how, and
15 what is logged.
16
17 Basic Functions
18
19 $Debug = new Net::XMPP::Debug();
20
21 $Debug->Init(level=>2,
22 file=>"stdout",
23 header=>"MyScript");
24
25 $Debug->Log0("Connection established");
26
28 Basic Functions
29
30 new(hash) - creates the Debug object. The hash argument is passed
31 to the Init function. See that function description
32 below for the valid settings.
33
34 Init(level=>integer, - initializes the debug object. The level
35 file=>string, determines the maximum level of debug
36 header=>string, messages to log:
37 setdefault=>0⎪1, 0 - Base level Output (default)
38 usedefault=>0⎪1, 1 - High level API calls
39 time=>0⎪1) 2 - Low level API calls
40 ...
41 N - Whatever you want....
42 The file determines where the debug log
43 goes. You can either specify a path to
44 a file, or "stdout" (the default). "stdout"
45 tells Debug to send all of the debug info
46 sent to this object to go to stdout.
47 header is a string that will preappended
48 to the beginning of all log entries. This
49 makes it easier to see what generated the
50 log entry (default is "Debug").
51 setdefault saves the current filehandle
52 and makes it available for other Debug
53 objects to use. To use the default set
54 usedefault to 1. The time parameter
55 specifies whether or not to add a timestamp
56 to the beginning of each logged line.
57
58 LogN(array) - Logs the elements of the array at the corresponding
59 debug level N. If you pass in a reference to an
60 array or hash then they are printed in a readable
61 way. (ie... Log0, Log2, Log100, etc...)
62
64 $Debug = new Net::XMPP:Debug(level=>2,
65 header=>"Example");
66
67 $Debug->Log0("test");
68
69 $Debug->Log2("level 2 test");
70
71 $hash{a} = "atest";
72 $hash{b} = "btest";
73
74 $Debug->Log1("hashtest",\%hash);
75
76 You would get the following log:
77
78 Example: test
79 Example: level 2 test
80 Example: hashtest { a=>"atest" b=>"btest" }
81
82 If you had set the level to 1 instead of 2 you would get:
83
84 Example: test
85 Example: hashtest { a=>"atest" b=>"btest" }
86
88 Ryan Eatmon
89
91 This module is free software, you can redistribute it and/or modify it
92 under the LGPL.
93
94
95
96perl v5.8.8 2007-04-02 Net::XMPP::Debug(3)