SYNOPSIS

     use Net::HTTP::Methods::Patch::LogRequest;
    
     # now all your LWP HTTP requests are logged

    Sample script and output:

     % LOG_SHOW_CATEGORY=1 TRACE=1 perl -MLog::Any::App \
       -MNet::HTTP::Methods::Patch::LogRequest -MWWW::Mechanize \
       -e'$mech=WWW::Mechanize->new; $mech->get("http://www.google.com/")'
     [cat Net.HTTP.Methods.Patch.LogRequest][23] HTTP request (142 bytes):
     GET / HTTP/1.1
     TE: deflate,gzip;q=0.3
     Connection: TE, close
     Accept-Encoding: gzip
     Host: www.google.com
     User-Agent: WWW-Mechanize/1.71
    
     [cat Net.HTTP.Methods.Patch.LogRequest][70] HTTP request (144 bytes):
     GET / HTTP/1.1
     TE: deflate,gzip;q=0.3
     Connection: TE, close
     Accept-Encoding: gzip
     Host: www.google.co.id
     User-Agent: WWW-Mechanize/1.71

DESCRIPTION

    This module patches Net::HTTP::Methods so that raw LWP HTTP request is
    logged using Log::Any. If you look into LWP::Protocol::http's source
    code, you'll see that it is already doing that (albeit commented):

      my $req_buf = $socket->format_request($method, $fullpath, @h);
      #print "------\n$req_buf\n------\n";

FAQ

 Why not subclass?

    By patching, you do not need to replace all the client code which uses
    LWP (or WWW::Mechanize, etc).

 How to log request content?

    See LWP::UserAgent::Patch::LogRequestContent.

