Net::XMPP::Debug(3pm)

πŸ’– NAME

okay so bestie, this is Net::XMPP::Debug β€” the XMPP Debug Module β€” from the 3pm manual section. It's the module that hands a developer easy access to logging debug info. ✨

πŸ¦‹ SYNOPSIS

Net::XMPP::Debug is a module that provides a developer easy access to logging debug information. no cap, that's the whole synopsis vibe 🫢

🌸 DESCRIPTION

Debug is a helper module for the Net::XMPP modules. It gives the Net::XMPP modules an object that controls where, how, and what is logged. πŸ’…

✨ Basic Functions

        $Debug = Net::XMPP::Debug->new();

        $Debug->Init(
               level  => 2,
               file   => "stdout",
               header =>"MyScript");

        $Debug->Log0("Connection established");

πŸ’… METHODS

πŸŽ€ Basic Functions

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. 🫢

Init

Init(
     level      => integer,
     file       => string,
     header     => string,
     setdefault => 0|1,
     usedefault => 0|1,
     time       => 0|1)

initializes the debug object. 🌸

  • level β€” 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....
  • file β€” 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. πŸ’–
  • header β€” a string that will be preappended to the beginning of all log entries. This makes it easier to see what generated the log entry (default is "Debug"). πŸŽ€
  • setdefault β€” saves the current filehandle and makes it available for other Debug objects to use. To use the default, set usedefault to 1.
  • usedefault β€” 0|1; set it to 1 when you want to use the default filehandle.
  • time β€” specifies whether or not to add a timestamp to the beginning of each logged line. ⭐

LogN

LogN(array)

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...) πŸ”₯

πŸ”₯ EXAMPLE

         $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", \%hash);

You would get the following log:

Example: test
Example: level 2 test
Example: hashtest { a=>"atest" b=>"btest" }

If you had set the level to 1 instead of 2, you would get:

Example: test
Example: hashtest { a=>"atest" b=>"btest" }

πŸ‘‘ AUTHOR

  • Originally authored by Ryan Eatmon.
  • Previously maintained by Eric Hacker.
  • Currently maintained by Darian Anthony Patrick. πŸ‘‘

This module is free software, you can redistribute it and/or modify it under the LGPL 2.1. 🫢


that's the whole page, bestie. source/version footer energy: perl v5.42.0, dated 2016-01-12, and it's the Net::XMPP::Debug(3pm) manual page. byeee πŸ«ΆπŸ’‹

πŸ“¦ where this page comes from