1LWP::ConsoleLogger::EveUrsyewrheCroen(t3r)ibuted Perl DoLcWuPm:e:nCtoantsioolneLogger::Everywhere(3)
2
3
4
6 LWP::ConsoleLogger::Everywhere - LWP tracing everywhere
7
9 version 0.000043
10
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
31 This module turns on LWP::ConsoleLogger::Easy debugging for every
32 LWP::UserAgent or Mojo::UserAgent based user agent anywhere in your
33 code. It doesn't matter what package or class it is in, or if you have
34 access to the object itself. All you need to do is "use" this module
35 anywhere in your code and it will work.
36
37 You can access and configure the loggers individually after they have
38 been created using the "loggers" class method. To change all of them at
39 once, use the "set" class method instead.
40
42 set( <setting> => <value> )
43 LWP::ConsoleLogger::Everywhere->set( dump_content => 0 );
44
45 This class method changes the given setting on all logger objects that
46 have been created so far. The first argument is the accessor name of
47 the setting you want to change, and the second argument is the new
48 value. This cannot be used to access current values. See "METHODS" in
49 LWP::ConsoleLogger#SUBROUTINES for what those settings are.
50
51 loggers
52 my $loggers = LWP::ConsoleLogger::Everywhere->loggers;
53 foreach my $logger ( @{ $loggers } ) {
54 # stop dumping headers
55 $logger->dump_headers( 0 );
56 }
57
58 This class method returns an array reference of all LWP::ConsoleLogger
59 objects that have been created so far, with the newest one last. You
60 can use them to fine-tune settings. If there is more than one user
61 agent in your application you will need to figure out which one is
62 which. Since this is for debugging only, trial and error is a good
63 strategy here.
64
66 If there are several different user agents in your application, you
67 will get debug output from all of them. This could be quite cluttered.
68
69 Since LWP::ConsoleLogger::Everywhere does its magic during compile time
70 it will most likely catch every user agent in your application, unless
71 you "use LWP::ConsoleLogger::Everywhere" inside a file that gets loaded
72 at runtime. If the user agent you wanted to debug had already been
73 created at that time it cannot hook into the constructor any more.
74
75 LWP::ConsoleLogger::Everywhere works by catching new user agents
76 directly in LWP::UserAgent when they are created. That way all properly
77 implemented sub classes like WWW::Mechanize will go through it. But if
78 you encounter one that installs its own handlers into the user agent
79 after calling "new" in LWP::UserAgent that might overwrite the ones
80 LWP::ConsoleLogger installed.
81
82 LWP::ConsoleLogger::Everywhere will keep references to all user agents
83 that were ever created during for the lifetime of your application. If
84 you have a lot of lexical user agents that you recycle all the time
85 they will not actually go away and might consume memory.
86
88 For more information or if you want more detailed control see
89 LWP::ConsoleLogger.
90
92 Olaf Alders <olaf@wundercounter.com>
93
95 This software is Copyright (c) 2014-2019 by MaxMind, Inc.
96
97 This is free software, licensed under:
98
99 The Artistic License 2.0 (GPL Compatible)
100
101
102
103perl v5.32.1 2021-03-05 LWP::ConsoleLogger::Everywhere(3)