1Net::XMPP::Debug(3)   User Contributed Perl Documentation  Net::XMPP::Debug(3)
2
3
4

NAME

6       Net::XMPP::Debug - XMPP Debug Module
7

SYNOPSIS

9         Net::XMPP::Debug is a module that provides a developer easy access
10         to logging debug information.
11

DESCRIPTION

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           $Debug = new Net::XMPP::Debug();
19
20           $Debug->Init(level=>2,
21                            file=>"stdout",
22                            header=>"MyScript");
23
24           $Debug->Log0("Connection established");
25

METHODS

27   Basic Functions
28           new(hash) - creates the Debug object.  The hash argument is passed
29                       to the Init function.  See that function description
30                       below for the valid settings.
31
32           Init(level=>integer,  - initializes the debug object.  The level
33                file=>string,      determines the maximum level of debug
34                header=>string,    messages to log:
35                setdefault=>0|1,     0 - Base level Output (default)
36                usedefault=>0|1,     1 - High level API calls
37                time=>0|1)           2 - Low level API calls
38                                     ...
39                                     N - Whatever you want....
40                                   The file determines where the debug log
41                                   goes.  You can either specify a path to
42                                   a file, or "stdout" (the default).  "stdout"
43                                   tells Debug to send all of the debug info
44                                   sent to this object to go to stdout.
45                                   header is a string that will preappended
46                                   to the beginning of all log entries.  This
47                                   makes it easier to see what generated the
48                                   log entry (default is "Debug").
49                                   setdefault saves the current filehandle
50                                   and makes it available for other Debug
51                                   objects to use.  To use the default set
52                                   usedefault to 1.  The time parameter
53                                   specifies whether or not to add a timestamp
54                                   to the beginning of each logged line.
55
56           LogN(array) - Logs the elements of the array at the corresponding
57                         debug level N.  If you pass in a reference to an
58                         array or hash then they are printed in a readable
59                         way.  (ie... Log0, Log2, Log100, etc...)
60

EXAMPLE

62         $Debug = new Net::XMPP:Debug(level=>2,
63                                      header=>"Example");
64
65           $Debug->Log0("test");
66
67           $Debug->Log2("level 2 test");
68
69           $hash{a} = "atest";
70           $hash{b} = "btest";
71
72           $Debug->Log1("hashtest",\%hash);
73
74         You would get the following log:
75
76           Example: test
77           Example: level 2 test
78           Example: hashtest { a=>"atest" b=>"btest" }
79
80         If you had set the level to 1 instead of 2 you would get:
81
82           Example: test
83           Example: hashtest { a=>"atest" b=>"btest" }
84

AUTHOR

86       Ryan Eatmon
87
89       This module is free software, you can redistribute it and/or modify it
90       under the LGPL.
91
92
93
94perl v5.12.0                      2010-05-04               Net::XMPP::Debug(3)
Impressum