SYNOPSIS

    use LWP::UserAgent::Patch::LogRequestContent;

    # now all your LWP HTTP request content are logged

   Sample script and output:

    % TRACE=1 perl -MLog::ger::Output=Screen
      -MNet::HTTP::Methods::Patch::LogRequest \
      -MLWP::UserAgent::Patch::LogRequestContent \
      -MLWP::UserAgent \
      -e'$ua = LWP::UserAgent->new;
         $ua->post("http://localhost:5000/", {a=>1, b=>2});'

    [cat LWP.UserAgent.Patch.LogRequestContent]HTTP request body (len=7):
    a=1&b=2

    [cat Net.HTTP.Methods.Patch.LogRequest]HTTP request (proto=http, len=186):
    POST / HTTP/1.1
    TE: deflate,gzip;q=0.3
    Connection: TE, close
    Host: localhost:5000
    User-Agent: libwww-perl/6.04
    Content-Length: 7
    Content-Type: application/x-www-form-urlencoded

   Or you can also use via Log::ger::For::LWP.

DESCRIPTION

   This module patches LWP::UserAgent (which is used by LWP::Simple,
   WWW::Mechanize, among others) so that HTTP request contents are logged
   using Log::ger.

FAQ

Why not subclass?

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

Why is the request content logged before request headers (when using with
Net::HTTP::Methods::Patch::LogRequest)?

   Yup, it's ugly. I'm working on that.

SEE ALSO

   Use Net::HTTP::Methods::Patch::LogRequest to log raw HTTP request
   headers being sent to servers.

   Use LWP::UserAgent::Patch::LogResponse to log HTTP responses.

   Log::ger::For::LWP bundles all three mentioned patches in a single
   convenient package.