1LWP::ConsoleLogger::EveUrsyewrheCroen(t3r)ibuted Perl DoLcWuPm:e:nCtoantsioolneLogger::Everywhere(3)
2
3
4

NAME

6       LWP::ConsoleLogger::Everywhere - LWP tracing everywhere
7

VERSION

9       version 0.000044
10

SYNOPSIS

12           use LWP::ConsoleLogger::Everywhere;
13
14           # somewhere deep down in the guts of your program
15           # there is some other module that creates an LWP::UserAgent
16           # and now it will tell you what it's up to
17
18           # somewhere else you can access and fine-tune those loggers
19           # individually:
20           my $loggers = LWP::ConsoleLogger::Everywhere->loggers;
21           $loggers->[0]->pretty(0);
22
23           # or all of them at once:
24           LWP::ConsoleLogger::Everywhere->set( pretty => 1);
25
26           # Redact sensitive data for all user agents
27           $ENV{LWPCL_REDACT_HEADERS} = 'Authorization,Foo,Bar';
28           $ENV{LWPCL_REDACT_PARAMS} = 'seekrit,password,credit_card';
29
30           # Or observe without changing your code
31           PERL5OPT="-MLWP::ConsoleLogger::Everywhere" carton install
32
33           perl -MLWP::ConsoleLogger::Everywhere my-script.pl
34

DESCRIPTION

36       This module turns on LWP::ConsoleLogger::Easy debugging for every
37       LWP::UserAgent or Mojo::UserAgent based user agent anywhere in your
38       code. It doesn't matter what package or class it is in, or if you have
39       access to the object itself. All you need to do is "use" this module
40       anywhere in your code and it will work.
41
42       You can access and configure the loggers individually after they have
43       been created using the "loggers" class method. To change all of them at
44       once, use the "set" class method instead.
45
46       See
47       <https://www.olafalders.com/2021/12/01/observing-network-traffic-with-lwp-consolelogger-everywhere/>
48       for a practical example of how to use this module.
49

CLASS METHODS

51   set( <setting> => <value> )
52           LWP::ConsoleLogger::Everywhere->set( dump_content => 0 );
53
54       This class method changes the given setting on all logger objects that
55       have been created so far. The first argument is the accessor name of
56       the setting you want to change, and the second argument is the new
57       value. This cannot be used to access current values. See "METHODS" in
58       LWP::ConsoleLogger#SUBROUTINES for what those settings are.
59
60   loggers
61           my $loggers = LWP::ConsoleLogger::Everywhere->loggers;
62           foreach my $logger ( @{ $loggers } ) {
63               # stop dumping headers
64               $logger->dump_headers( 0 );
65           }
66
67       This class method returns an array reference of all LWP::ConsoleLogger
68       objects that have been created so far, with the newest one last. You
69       can use them to fine-tune settings. If there is more than one user
70       agent in your application you will need to figure out which one is
71       which.  Since this is for debugging only, trial and error is a good
72       strategy here.
73

CAVEATS

75       If there are several different user agents in your application, you
76       will get debug output from all of them. This could be quite cluttered.
77
78       Since LWP::ConsoleLogger::Everywhere does its magic during compile time
79       it will most likely catch every user agent in your application, unless
80       you "use LWP::ConsoleLogger::Everywhere" inside a file that gets loaded
81       at runtime.  If the user agent you wanted to debug had already been
82       created at that time it cannot hook into the constructor any more.
83
84       LWP::ConsoleLogger::Everywhere works by catching new user agents
85       directly in LWP::UserAgent when they are created. That way all properly
86       implemented sub classes like WWW::Mechanize will go through it. But if
87       you encounter one that installs its own handlers into the user agent
88       after calling "new" in LWP::UserAgent that might overwrite the ones
89       LWP::ConsoleLogger installed.
90
91       LWP::ConsoleLogger::Everywhere will keep references to all user agents
92       that were ever created during for the lifetime of your application. If
93       you have a lot of lexical user agents that you recycle all the time
94       they will not actually go away and might consume memory.
95

SEE ALSO

97       For more information or if you want more detailed control see
98       LWP::ConsoleLogger.
99

AUTHOR

101       Olaf Alders <olaf@wundercounter.com>
102
104       This software is Copyright (c) 2014 by MaxMind, Inc.
105
106       This is free software, licensed under:
107
108         The Artistic License 2.0 (GPL Compatible)
109
110
111
112perl v5.34.1                      2022-04-22 LWP::ConsoleLogger::Everywhere(3)
Impressum