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 to
10       logging debug information.
11

DESCRIPTION

13       Debug is a helper module for the Net::XMPP modules.  It provides the
14       Net::XMPP modules with an object to control where, how, and what is
15       logged.
16
17   Basic Functions
18           $Debug = Net::XMPP::Debug->new();
19
20           $Debug->Init(
21                  level  => 2,
22                  file   => "stdout",
23                  header =>"MyScript");
24
25           $Debug->Log0("Connection established");
26

METHODS

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

EXAMPLE

79         $Debug = Net::XMPP:Debug->new(level=>2,
80                                      header=>"Example");
81
82         $Debug->Log0("test");
83
84         $Debug->Log2("level 2 test");
85
86         $hash{a} = "atest";
87         $hash{b} = "btest";
88
89         $Debug->Log1("hashtest", \%hash);
90
91       You would get the following log:
92
93           Example: test
94           Example: level 2 test
95           Example: hashtest { a=>"atest" b=>"btest" }
96
97       If you had set the level to 1 instead of 2 you would get:
98
99           Example: test
100           Example: hashtest { a=>"atest" b=>"btest" }
101

AUTHOR

103       Originally authored by Ryan Eatmon.
104
105       Previously maintained by Eric Hacker.
106
107       Currently maintained by Darian Anthony Patrick.
108
110       This module is free software, you can redistribute it and/or modify it
111       under the LGPL 2.1.
112
113
114
115perl v5.32.1                      2021-01-27               Net::XMPP::Debug(3)
Impressum