1LWP::ConsoleLogger::EasUys(e3r)Contributed Perl DocumentLaWtPi:o:nConsoleLogger::Easy(3)
2
3
4

NAME

6       LWP::ConsoleLogger::Easy - Easy LWP tracing and debugging
7

VERSION

9       version 0.000039
10

SYNOPSIS

12           use LWP::ConsoleLogger::Easy qw( debug_ua );
13           use WWW::Mechanize;
14
15           my $mech = WWW::Mechanize->new;
16           my $logger = debug_ua( $mech );
17           $mech->get('https://google.com');
18
19           # now watch the console for debugging output
20
21           # ...
22           # stop dumping headers
23           $logger->dump_headers( 0 );
24
25           # Redact sensitive data
26           $ENV{LWPCL_REDACT_HEADERS} = 'Authorization,Foo,Bar';
27           $ENV{LWPCL_REDACT_PARAMS} = 'seekrit,password,credit_card';
28
29           my $quiet_logger = debug_ua( $mech, 1 );
30
31           my $noisy_logger = debug_ua( $mech, 5 );
32

DESCRIPTION

34       This module gives you the easiest possible introduction to
35       LWP::ConsoleLogger.  It offers one wrapper around LWP::ConsoleLogger:
36       "debug_ua".  This function allows you to get up and running quickly
37       with just a couple of lines of code. It instantiates LWP logging and
38       also returns a LWP::ConsoleLogger object, which you may then tweak to
39       your heart's desire.
40
41       If you're able to install HTML::FormatText::Lynx then you'll get highly
42       readable HTML to text conversions.
43

FUNCTIONS

45   debug_ua( $mech, $verbosity )
46       When called without a verbosity argument, this function turns on all
47       logging.  I'd suggest going with this to start with and then turning
48       down the verbosity after that.   This method returns an
49       LWP::ConsoleLogger object, which you may tweak to your heart's desire.
50
51           my $ua_logger = debug_ua( $mech );
52           $ua_logger->content_pre_filter( sub {...} );
53           $ua_logger->logger( Log::Dispatch->new(...) );
54
55           $mech->get(...);
56
57       You can provide a verbosity level of 0 or more.  (Currently 0 - 8
58       supported.)  This will turn up the verbosity on your output gradually.
59       A verbosity of 0 will display nothing.  8 will display all available
60       outputs.
61
62           # don't get too verbose
63           my $ua_logger = debug_ua( $mech, 4 );
64
65   add_ua_handlers
66       This method sets up response and request handlers on your user agent.
67       This is done for you automatically if you're using "debug_ua".
68

ENVIRONMENT VARIABLES

70   LWPCL_REDACT_HEADERS
71       A comma-separated list of header values to redact from output.
72
73           $ENV{LWPCL_REDACT_HEADERS} = 'Authorization,Foo,Bar';
74
75       Output will be something like:
76
77           .----------------+------------------.
78           | Request Header | Value            |
79           +----------------+------------------+
80           | Authorization  | [REDACTED]       |
81           | Content-Length | 0                |
82           | User-Agent     | libwww-perl/6.15 |
83           '----------------+------------------'
84
85       Use at the command line.
86
87           LWPCL_REDACT_HEADERS='Authorization,Foo,Bar' perl script.pl
88
89   LWPCL_REDACT_PARAMS
90       A comma-separated list of parameter values to redact from output.
91
92           $ENV{LWPCL_REDACT_PARAMS} = 'credit_card,foo,bar';
93
94       Use at the command line.
95
96           LWPCL_REDACT_PARAMS='credit_card,foo,bar' perl script.pl
97
98           .-------------+------------.
99           | Key         | Value      |
100           +-------------+------------+
101           | credit_card | [REDACTED] |
102           '-------------+------------'
103
104   CAVEATS
105       Text formatting now defaults to attempting to use
106       HTML::FormatText::Lynx to format HTML as text.  If you do not have this
107       installed, we'll fall back to using HTML::Restrict to remove any HTML
108       tags which you have not specifically whitelisted.
109
110       If you have HTML::FormatText::Lynx installed, but you don't want to use
111       it, override the default filter:
112
113           my $logger = debug_ua( $mech );
114           $logger->text_pre_filter( sub { return shift } );
115
116   EXAMPLES
117       Please see the "examples" folder in this distribution for more ideas on
118       how to use this module.
119

AUTHOR

121       Olaf Alders <olaf@wundercounter.com>
122
124       This software is Copyright (c) 2014-2017 by MaxMind, Inc.
125
126       This is free software, licensed under:
127
128         The Artistic License 2.0 (GPL Compatible)
129
130
131
132perl v5.28.1                      2018-08-01       LWP::ConsoleLogger::Easy(3)
Impressum