New Upstream Snapshot - libplack-middleware-logany-perl

Ready changes

Summary

Merged new upstream version: 0.002001 (was: 0.001).

Resulting package

Built on 2023-01-16T12:38 (took 9m38s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots libplack-middleware-logany-perl

Lintian Result

Diff

diff --git a/Changes b/Changes
new file mode 100644
index 0000000..03fe28c
--- /dev/null
+++ b/Changes
@@ -0,0 +1,32 @@
+Release history for Plack-Middleware-LogAny
+
+0.002001  2022-12-19
+          - fix required test dependency
+            (at least Log::Any::Adapter::Log4perl 0.09 needed)
+
+0.002     2022-12-17
+          - revert release history
+          - revise perl pod
+          - on request pass HTTP headers to logging context
+
+0.001003  2022-12-10
+          - use tailcall to replace the current invocation of psgix.logger
+          - make sure that the issuer of a logging request (%M) is set
+            properly [RT #144221]
+
+0.001002  2022-12-05
+          - do not create authoring related MakeMaker postamble section
+            on some platforms (background: the make syntax differs)
+
+0.001001  2022-12-01
+          - adoption (original author:
+            Michael Alan Dorman <mdorman@ironicdesign.com>)
+          - change authoring tool
+            (from Dist::Zilla to ExtUtils::MakeMaker::CPANfile)
+          - add this Changes file
+          - tidy source code and test script
+          - increase test coverage to 100%
+          - handle 0 category accurately
+
+0.001     2012-11-02
+          - initial release
diff --git a/LICENSE b/LICENSE
index 23bbf9f..c2996fc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -12,7 +12,7 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2012 by Michael Alan Dorman.
+This software is Copyright (c) 2012 by Sven Willenbuecher.
 
 This is free software, licensed under:
 
@@ -22,7 +22,7 @@ This is free software, licensed under:
                      Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
+ 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
@@ -272,7 +272,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2012 by Michael Alan Dorman.
+This software is Copyright (c) 2012 by Sven Willenbuecher.
 
 This is free software, licensed under:
 
@@ -292,21 +292,21 @@ Definitions:
 
   - "Package" refers to the collection of files distributed by the Copyright
     Holder, and derivatives of that collection of files created through
-    textual modification. 
+    textual modification.
   - "Standard Version" refers to such a Package if it has not been modified,
     or has been modified in accordance with the wishes of the Copyright
-    Holder. 
+    Holder.
   - "Copyright Holder" is whoever is named in the copyright or copyrights for
-    the package. 
+    the package.
   - "You" is you, if you're thinking about copying or distributing this Package.
   - "Reasonable copying fee" is whatever you can justify on the basis of media
     cost, duplication charges, time of people involved, and so on. (You will
     not be required to justify it to the Copyright Holder, but only to the
-    computing community at large as a market that must bear the fee.) 
+    computing community at large as a market that must bear the fee.)
   - "Freely Available" means that no fee is charged for the item itself, though
     there may be fees involved in handling the item. It also means that
     recipients of the item may redistribute it under the same conditions they
-    received it. 
+    received it.
 
 1. You may make and give away verbatim copies of the source form of the
 Standard Version of this Package without restriction, provided that you
@@ -373,7 +373,7 @@ products derived from this software without specific prior written permission.
 
 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
 The End
 
diff --git a/MANIFEST b/MANIFEST
index d6ddab4..f12517b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,10 +1,13 @@
+Changes
+cpanfile
+lib/Plack/Middleware/LogAny.pm
+lib/Plack/Middleware/LogAny.pod
 LICENSE
-MANIFEST
-META.yml
 Makefile.PL
-README
-dist.ini
-lib/Plack/Middleware/LogAny.pm
-t/release-pod-coverage.t
-t/release-pod-syntax.t
-t/simple.t
+MANIFEST			This list of files
+t/advanced.t
+t/basic.t
+t/context-advanced.t
+t/context-basic.t
+META.yml                                 Module YAML meta-data (added by MakeMaker)
+META.json                                Module JSON meta-data (added by MakeMaker)
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..0a23ff6
--- /dev/null
+++ b/META.json
@@ -0,0 +1,67 @@
+{
+   "abstract" : "Use Log::Any to handle logging from your PSGI application",
+   "author" : [
+      "Sven Willenbuecher <sven.willenbuecher@kuehne-nagel.com>"
+   ],
+   "dynamic_config" : 0,
+   "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010",
+   "license" : [
+      "perl_5"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+      "version" : 2
+   },
+   "name" : "Plack-Middleware-LogAny",
+   "no_index" : {
+      "directory" : [
+         "t",
+         "inc"
+      ]
+   },
+   "prereqs" : {
+      "build" : {
+         "requires" : {
+            "ExtUtils::MakeMaker" : "0"
+         }
+      },
+      "configure" : {
+         "requires" : {
+            "Config" : "0",
+            "ExtUtils::MakeMaker::CPANfile" : "0.09"
+         }
+      },
+      "develop" : {
+         "suggests" : {
+            "App::Software::License" : "0",
+            "Pod::Markdown::Github" : "0"
+         }
+      },
+      "runtime" : {
+         "requires" : {
+            "Log::Any" : "1.711",
+            "Plack::Middleware" : "0",
+            "Plack::Util::Accessor" : "0"
+         }
+      },
+      "test" : {
+         "requires" : {
+            "Log::Any::Adapter::Log4perl" : "0.09",
+            "Test::More" : "0"
+         }
+      }
+   },
+   "release_status" : "stable",
+   "resources" : {
+      "bugtracker" : {
+         "web" : "https://github.com/XSven/Plack-Middleware-LogAny/issues"
+      },
+      "repository" : {
+         "type" : "git",
+         "url" : "git://github.com/XSven/Plack-Middleware-LogAny.git",
+         "web" : "https://github.com/XSven/Plack-Middleware-LogAny"
+      }
+   },
+   "version" : "0.002001",
+   "x_serialization_backend" : "JSON::PP version 4.07"
+}
diff --git a/META.yml b/META.yml
index 761ce39..d892392 100644
--- a/META.yml
+++ b/META.yml
@@ -1,27 +1,31 @@
 ---
-abstract: 'Use Log::Any to handle logging from your Plack app'
+abstract: 'Use Log::Any to handle logging from your PSGI application'
 author:
-  - 'Michael Alan Dorman <mdorman@ironicdesign.com>'
+  - 'Sven Willenbuecher <sven.willenbuecher@kuehne-nagel.com>'
 build_requires:
-  HTTP::Request::Common: 0
-  Log::Any::Test: 0
-  Plack::Test: 0
-  Test::More: 0
-  Try::Tiny: 0
+  ExtUtils::MakeMaker: '0'
+  Log::Any::Adapter::Log4perl: '0.09'
+  Test::More: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 6.30
+  Config: '0'
+  ExtUtils::MakeMaker::CPANfile: '0.09'
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300020, CPAN::Meta::Converter version 2.120921'
+generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Plack-Middleware-LogAny
+no_index:
+  directory:
+    - t
+    - inc
 requires:
-  Log::Any: 0
-  Plack::Middleware: 0
-  Plack::Util::Accessor: 0
-  parent: 0
-  strict: 0
-  warnings: 0
-version: 0.001
+  Log::Any: '1.711'
+  Plack::Middleware: '0'
+  Plack::Util::Accessor: '0'
+resources:
+  bugtracker: https://github.com/XSven/Plack-Middleware-LogAny/issues
+  repository: git://github.com/XSven/Plack-Middleware-LogAny.git
+version: '0.002001'
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/Makefile.PL b/Makefile.PL
index 15c304e..172345a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,62 +1,58 @@
+#<<<
+use strict; use warnings;
+#>>>
 
-use strict;
-use warnings;
-
-
-
-use ExtUtils::MakeMaker 6.30;
-
-
+use Config                        qw( %Config );
+use ExtUtils::MakeMaker::CPANfile qw( WriteMakefile );
 
 my %WriteMakefileArgs = (
-  "ABSTRACT" => "Use Log::Any to handle logging from your Plack app",
-  "AUTHOR" => "Michael Alan Dorman <mdorman\@ironicdesign.com>",
-  "BUILD_REQUIRES" => {
-    "HTTP::Request::Common" => 0,
-    "Log::Any::Test" => 0,
-    "Plack::Test" => 0,
-    "Test::More" => 0,
-    "Try::Tiny" => 0
-  },
-  "CONFIGURE_REQUIRES" => {
-    "ExtUtils::MakeMaker" => "6.30"
-  },
-  "DISTNAME" => "Plack-Middleware-LogAny",
-  "EXE_FILES" => [],
-  "LICENSE" => "perl",
-  "NAME" => "Plack::Middleware::LogAny",
-  "PREREQ_PM" => {
-    "Log::Any" => 0,
-    "Plack::Middleware" => 0,
-    "Plack::Util::Accessor" => 0,
-    "parent" => 0,
-    "strict" => 0,
-    "warnings" => 0
+  NAME          => 'Plack::Middleware::LogAny',
+  AUTHOR        => 'Sven Willenbuecher <sven.willenbuecher@kuehne-nagel.com>',
+  VERSION_FROM  => 'lib/Plack/Middleware/LogAny.pm',
+  ABSTRACT_FROM => 'lib/Plack/Middleware/LogAny.pod',
+  LICENSE       => 'Perl_5',
+  META_MERGE    => {
+    'meta-spec' => { version => 2 },
+    resources   => {
+      repository => {
+        type => 'git',
+        url  => 'git://github.com/XSven/Plack-Middleware-LogAny.git',
+        web  => 'https://github.com/XSven/Plack-Middleware-LogAny',
+      },
+      bugtracker => {
+        web => 'https://github.com/XSven/Plack-Middleware-LogAny/issues',
+      },
+    },
   },
-  "VERSION" => "0.001",
-  "test" => {
-    "TESTS" => "t/*.t"
-  }
+  dist      => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+  clean     => { FILES    => 'Plack-Middleware-LogAny-* cover_db' },
+  realclean => { FILES    => 'local' },
 );
 
-
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
-  my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
-  my $pp = $WriteMakefileArgs{PREREQ_PM};
-  for my $mod ( keys %$br ) {
-    if ( exists $pp->{$mod} ) {
-      $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
-    }
-    else {
-      $pp->{$mod} = $br->{$mod};
-    }
+unless ( $Config{ osname } =~ m/\A(?:freebsd|openbsd|solaris)\z/ or exists( $ENV{ MAKELEVEL } ) ) {
+  my $local_lib = "$ENV{ PWD }/local/lib/perl5";
+  require lib; lib->import( $local_lib );
+
+  no warnings 'once';
+  *MY::postamble = sub {
+    my $make_fragment .= <<"MAKE_FRAGMENT";
+ifdef PERL5LIB
+  PERL5LIB := $local_lib:\$(PERL5LIB)
+else
+  export PERL5LIB := $local_lib
+endif
+
+.PHONY: installdeps
+installdeps: cpanfile
+	cpanm --no-man-pages --local-lib-contained $local_lib/../.. --installdeps .
+
+.PHONY: cover
+cover:
+	cover -test -ignore local -report vim
+MAKE_FRAGMENT
+
+    return $make_fragment;
   }
 }
 
-delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
-  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
-
-WriteMakefile(%WriteMakefileArgs);
-
-
-
+WriteMakefile( %WriteMakefileArgs );
diff --git a/README b/README
deleted file mode 100644
index 5aed743..0000000
--- a/README
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-This archive contains the distribution Plack-Middleware-LogAny,
-version 0.001:
-
-  Use Log::Any to handle logging from your Plack app
-
-This software is copyright (c) 2012 by Michael Alan Dorman.
-
-This is free software; you can redistribute it and/or modify it under
-the same terms as the Perl 5 programming language system itself.
-
-
diff --git a/cpanfile b/cpanfile
new file mode 100644
index 0000000..562dc68
--- /dev/null
+++ b/cpanfile
@@ -0,0 +1,24 @@
+#<<<
+use strict; use warnings;
+#>>>
+
+on 'configure' => sub {
+  requires 'Config'                        => '0';
+  requires 'ExtUtils::MakeMaker::CPANfile' => '0';
+};
+
+on 'runtime' => sub {
+  requires 'Log::Any'              => '>= 1.711';
+  requires 'Plack::Middleware'     => '0';
+  requires 'Plack::Util::Accessor' => '0';
+};
+
+on 'test' => sub {
+  requires 'Test::More'                  => '0';
+  requires 'Log::Any::Adapter::Log4perl' => '>= 0.09';
+};
+
+on 'develop' => sub {
+  suggests 'App::Software::License' => 0;
+  suggests 'Pod::Markdown::Github'  => 0;
+};
diff --git a/debian/changelog b/debian/changelog
index 0ea314b..e1fe459 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libplack-middleware-logany-perl (0.002001-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Mon, 16 Jan 2023 12:32:13 -0000
+
 libplack-middleware-logany-perl (0.001-3) unstable; urgency=medium
 
   [ Debian Janitor ]
diff --git a/dist.ini b/dist.ini
deleted file mode 100644
index b193f02..0000000
--- a/dist.ini
+++ /dev/null
@@ -1,20 +0,0 @@
-author = Michael Alan Dorman <mdorman@ironicdesign.com>
-copyright_holder = Michael Alan Dorman
-license = Perl_5
-name = Plack-Middleware-LogAny
-
-[AutoPrereqs]
-[@Basic]
-[@Git]
-tag_format = dzil/%v
-[Git::CommitBuild]
-branch =
-release_branch = upstream
-[Git::NextVersion]
-version_regexp = ^dzil/(.+)$
-[ManifestSkip]
-[PkgVersion]
-[PodCoverageTests]
-[PodSyntaxTests]
-[PodWeaver]
-[PruneCruft]
diff --git a/lib/Plack/Middleware/LogAny.pm b/lib/Plack/Middleware/LogAny.pm
index 729d73e..73e7c4e 100644
--- a/lib/Plack/Middleware/LogAny.pm
+++ b/lib/Plack/Middleware/LogAny.pm
@@ -1,99 +1,55 @@
+#<<<
+use strict; use warnings;
+#>>>
+
 package Plack::Middleware::LogAny;
-{
-  $Plack::Middleware::LogAny::VERSION = '0.001';
-}
-# ABSTRACT: Use Log::Any to handle logging from your Plack app
 
-use Log::Any qw{};
-use Plack::Util::Accessor qw{category logger};
-use parent qw{Plack::Middleware};
-use strict;
-use warnings;
+our $VERSION = '0.002001';
 
+use parent                qw( Plack::Middleware );
+use subs                  qw( _name_to_key );
+use Log::Any              qw();
+use Plack::Util::Accessor qw( category context logger );
 
 sub prepare_app {
-    my ($self) = @_;
-    $self->logger (Log::Any->get_logger (category => $self->category || ''));
+  my ( $self ) = @_;
+  $self->logger( Log::Any->get_logger( category => defined $self->category ? $self->category : '' ) );
 }
 
-
 sub call {
-    my ($self, $env) = @_;
-
-    $env->{'psgix.logger'} = sub {
-        my $args = shift;
-        my $level = $args->{level};
-        $self->logger->$level ($args->{message});
-    };
-
-    $self->app->($env);
-}
-
-1;
-
-__END__
-=pod
-
-=head1 NAME
-
-Plack::Middleware::LogAny - Use Log::Any to handle logging from your Plack app
-
-=head1 VERSION
-
-version 0.001
-
-=head1 SYNOPSIS
-
-  builder {
-      enable "LogAny", category => "plack";
-      $app;
+  my ( $self, $env ) = @_;
+
+  my %header;
+  if ( my $context = $self->context ) {
+    foreach my $name ( @{ $context } ) {
+      my $key = _name_to_key $name;
+      $header{ $name } = $env->{ $key } if defined $env->{ $key };
+    }
   }
 
-=head1 DESCRIPTION
-
-LogAny is a L<Plack::Middleware> component that allows you to use
-L<Log::Any> to handle the logging object, C<psgix.logger>.
-
-It really tries to be the thinnest possible shim, so it doesn't handle
-any configuration beyond setting the category to which messages from
-plack might be logged.
+  my $logger = $self->logger;
+  local @{ $logger->context }{ keys %header } = values %header if %header;
 
-=head1 METHODS
+  $env->{ 'psgix.logger' } = sub {
+    my ( $level, $message ) = @{ $_[ 0 ] }{ qw( level message ) };
 
-=head2 prepare_app
+    @_ = ( $logger, $message );
+    goto &{ $logger->can( $level ) };
+  };
 
-This method initializes the logger using the category that you
-(optionally) set.
-
-=head2 call
-
-Actually handles making sure the logger is invoked.
-
-=head1 CONFIGURATION
-
-=over 4
-
-=item category
-
-The C<Log::Any> category to send logs to. Defaults to C<''> which
-means it send to the root logger.
-
-=back
-
-=head1 SEE ALSO
-
-L<Log::Any>
-
-=head1 AUTHOR
-
-Michael Alan Dorman <mdorman@ironicdesign.com>
-
-=head1 COPYRIGHT AND LICENSE
+  $self->app->( $env );
+}
 
-This software is copyright (c) 2012 by Michael Alan Dorman.
+sub _name_to_key ( $ ) {
+  my ( $name ) = @_;
 
-This is free software; you can redistribute it and/or modify it under
-the same terms as the Perl 5 programming language system itself.
+  ( my $key = $name ) =~ s/-/_/g;
+  $key = uc $key;
+  if ( $key !~ /\A(?:CONTENT_LENGTH|CONTENT_TYPE)\z/ ) {
+    $key = "HTTP_$key";
+  }
 
-=cut
+  return $key;
+}
 
+1;
diff --git a/lib/Plack/Middleware/LogAny.pod b/lib/Plack/Middleware/LogAny.pod
new file mode 100644
index 0000000..54414d4
--- /dev/null
+++ b/lib/Plack/Middleware/LogAny.pod
@@ -0,0 +1,76 @@
+=pod
+
+=head1 NAME
+
+Plack::Middleware::LogAny - Use Log::Any to handle logging from your PSGI
+application
+
+=head1 SYNOPSIS
+
+  # in app.psgi file
+  use Plack::Builder;
+
+  # PSGI application
+  my $app = sub { ... };
+
+  # DSL interface
+  builder {
+    enable 'LogAny', category => 'plack', context => [ qw( X-Request-ID ) ];
+    $app;
+  }
+
+  # alternative OO interface
+  Plack::Middleware::LogAny->wrap( $app, category => 'plack', context => [ qw( X-Request-ID ) ] );
+
+=head1 DESCRIPTION
+
+LogAny is a L<Plack::Middleware> component that allows you to use L<Log::Any>
+to handle the C<psgix.logger> logging object. This object is a code reference
+that is described in L<PSGI::Extensions>.
+
+=head1 METHODS
+
+=head2 prepare_app()
+
+This method initializes the logger using the category that you (optionally)
+set.
+
+=head2 call()
+
+This method sets the logging object and the logging context. The logging
+context is localized.
+
+=head1 CONFIGURATION OPTIONS
+
+=over 4
+
+=item category
+
+The C<Log::Any> category to send logs to. Defaults to C<''> which means it send
+to the root logger.
+
+=item context
+
+As of release 0.002.
+
+A list of HTTP header names that is passed from the L<PSGI
+environment|PSGI/"The Environment"> to the C<Log::Any> logging context.
+
+=back
+
+=head1 AUTHOR
+
+Sven Willenbuecher <sven.willenbuecher@kuehne-nagel.com>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2012 by Michael Alan Dorman.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=head1 SEE ALSO
+
+L<Log::Any>
+
+=cut
diff --git a/t/advanced.t b/t/advanced.t
new file mode 100755
index 0000000..b7836c0
--- /dev/null
+++ b/t/advanced.t
@@ -0,0 +1,66 @@
+#<<<
+use strict; use warnings;
+#>>>
+
+use Test::More import => [ qw( BAIL_OUT is_deeply use_ok ) ], tests => 3;
+
+use HTTP::Request::Common       qw( GET );
+use Log::Any::Adapter           qw();
+use Log::Any::Adapter::Log4perl qw();
+use Plack::Test                 qw();
+
+my $middleware;
+
+BEGIN {
+  $middleware = 'Plack::Middleware::LogAny';
+  use_ok( $middleware ) or BAIL_OUT "Cannot load middleware '$middleware'!";
+}
+
+my $conf = q(
+  log4perl.rootLogger             = TRACE, BUFFER
+  log4perl.appender.BUFFER        = Log::Log4perl::Appender::TestBuffer
+  log4perl.appender.BUFFER.name   = buffer
+  log4perl.appender.BUFFER.layout = Log::Log4perl::Layout::PatternLayout
+  log4perl.appender.BUFFER.layout.ConversionPattern = %c,%p,%M,%m%n
+);
+Log::Log4perl->init( \$conf );
+Log::Any::Adapter->set( 'Log::Log4perl' );
+
+my $app_name = 'My::PSGI::app';    # Issuer of the logging request (%M)
+my $category;
+my $messages;
+
+my $app = sub {
+  local *__ANON__ = $app_name;
+  my ( $env ) = @_;
+  map { $env->{ 'psgix.logger' }->( $_ ) } @{ $messages };
+  return [ 200, [], [] ];
+};
+
+$category = '';
+$messages = [
+  { level => 'trace', message => 'this is a trace message' },
+  { level => 'debug', message => 'this is a debug message' }
+];
+
+Plack::Test->create( $middleware->wrap( $app ) )->request( GET '/' );
+
+my $test_appender = Log::Log4perl::Appender::TestBuffer->by_name( 'buffer' );
+
+is_deeply [ split( "\n", $test_appender->buffer ) ],
+  [ map { join( ',', ( $category, uc $_->{ level }, $app_name, $_->{ message } ) ) } @$messages ],
+  'check Log::Log4perl::Appender::TestBuffer (root logger based logging)';
+$test_appender->clear;
+
+$category = 'plack.test';
+$messages = [
+  { level => 'info', message => 'this is an info message' },
+  { level => 'warn', message => 'this is a warn message' }
+];
+
+Plack::Test->create( $middleware->wrap( $app, category => $category ) )->request( GET '/' );
+
+is_deeply [ split( "\n", $test_appender->buffer ) ],
+  [ map { join( ',', ( $category, uc $_->{ level }, $app_name, $_->{ message } ) ) } @$messages ],
+  'check Log::Log4perl::Appender::TestBuffer';
+$test_appender->clear;
diff --git a/t/basic.t b/t/basic.t
new file mode 100755
index 0000000..6dad0c5
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,46 @@
+#<<<
+use strict; use warnings;
+#>>>
+
+use Test::More import => [ qw( BAIL_OUT is_deeply use_ok ) ], tests => 3;
+
+use HTTP::Request::Common qw( GET );
+use Log::Any::Test        qw();
+use Log::Any              qw( $logger );    # Log::Any global log buffer category is "main"
+use Plack::Test           qw();
+
+my $middleware;
+
+BEGIN {
+  $middleware = 'Plack::Middleware::LogAny';
+  use_ok( $middleware ) or BAIL_OUT "Cannot load middleware '$middleware'!";
+}
+
+my $category;
+my $messages;
+
+my $app = sub {
+  my ( $env ) = @_;
+  map { $env->{ 'psgix.logger' }->( $_ ) } @{ $messages };
+  return [ 200, [], [] ];
+};
+
+$category = '';
+$messages = [
+  { category => $category, level => 'trace', message => 'this is a trace message' },
+  { category => $category, level => 'debug', message => 'this is a debug message' }
+];
+
+Plack::Test->create( $middleware->wrap( $app ) )->request( GET '/' );
+is_deeply $logger->msgs, $messages, 'check Log::Any global log buffer (root logger based logging)';
+
+$logger->clear;
+
+$category = 'plack.test';
+$messages = [
+  { category => $category, level => 'info',    message => 'this is an info message' },
+  { category => $category, level => 'warning', message => 'this is a warning message' }
+];
+
+Plack::Test->create( $middleware->wrap( $app, category => $category ) )->request( GET '/' );
+is_deeply $logger->msgs, $messages, 'check Log::Any global log buffer';
diff --git a/t/context-advanced.t b/t/context-advanced.t
new file mode 100755
index 0000000..c331bcc
--- /dev/null
+++ b/t/context-advanced.t
@@ -0,0 +1,57 @@
+#<<<
+use strict; use warnings;
+#>>>
+
+use Test::More import => [ qw( BAIL_OUT is is_deeply use_ok ) ], tests => 3;
+
+use HTTP::Request::Common       qw( GET );
+use Log::Any::Adapter           qw();
+use Log::Any::Adapter::Log4perl qw();
+use Plack::Test                 qw();
+
+my $middleware;
+
+BEGIN {
+  $middleware = 'Plack::Middleware::LogAny';
+  use_ok( $middleware ) or BAIL_OUT "Cannot load middleware '$middleware'!";
+}
+
+my $header_name  = 'X-Request-ID';
+my $header_value = '77e1c83b-7bb0-437b-bc50-a7a58e5660ac';
+
+my $conf = qq(
+  log4perl.rootLogger             = TRACE, BUFFER
+  log4perl.appender.BUFFER        = Log::Log4perl::Appender::TestBuffer
+  log4perl.appender.BUFFER.name   = buffer
+  log4perl.appender.BUFFER.layout = Log::Log4perl::Layout::PatternLayout
+  log4perl.appender.BUFFER.layout.ConversionPattern = %c,%p,%X{$header_name},%M,%m%n
+);
+Log::Log4perl->init( \$conf );
+Log::Any::Adapter->set( 'Log::Log4perl' );
+
+my $app_name = 'My::PSGI::app';    # Issuer of the logging request (%M)
+my $category;
+my $messages;
+
+my $app = sub {
+  local *__ANON__ = $app_name;
+  my ( $env ) = @_;
+  map { $env->{ 'psgix.logger' }->( $_ ) } @{ $messages };
+  return [ 200, [], [] ];
+};
+
+$category = '';
+$messages = [
+  { level => 'trace', message => 'this is a trace message' },
+  { level => 'debug', message => 'this is a debug message' }
+];
+
+Plack::Test->create( $middleware->wrap( $app, context => [ 'Content-Type', 'X-B3-TraceId', $header_name ] ) )
+  ->request( GET '/', $header_name => $header_value );
+
+my $test_appender = Log::Log4perl::Appender::TestBuffer->by_name( 'buffer' );
+
+is_deeply [ split( "\n", $test_appender->buffer ) ],
+  [ map { join( ',', ( $category, uc $_->{ level }, $header_value, $app_name, $_->{ message } ) ) } @$messages ],
+  'check Log::Log4perl::Appender::TestBuffer (root logger based logging)';
+is scalar %{ Log::Any->get_logger( category => $category )->context }, 0, 'empty logging context';
diff --git a/t/context-basic.t b/t/context-basic.t
new file mode 100644
index 0000000..d51dcae
--- /dev/null
+++ b/t/context-basic.t
@@ -0,0 +1,49 @@
+#<<<
+use strict; use warnings;
+#>>>
+
+use Test::More import => [ qw( BAIL_OUT is is_deeply use_ok ) ], tests => 5;
+
+use HTTP::Request::Common qw( GET );
+use Log::Any::Test        qw();
+use Log::Any              qw( $logger );    # Log::Any global log buffer category is "main"
+use Plack::Test           qw();
+
+my $middleware;
+
+BEGIN {
+  $middleware = 'Plack::Middleware::LogAny';
+  use_ok( $middleware ) or BAIL_OUT "Cannot load middleware '$middleware'!";
+}
+
+my $category;
+my $messages;
+
+my $app = sub {
+  my ( $env ) = @_;
+  map { $env->{ 'psgix.logger' }->( $_ ) } @{ $messages };
+  return [ 200, [], [] ];
+};
+
+$category = '';
+$messages = [
+  { category => $category, level => 'trace', message => 'this is a trace message' },
+  { category => $category, level => 'debug', message => 'this is a debug message' }
+];
+
+my $header_name  = 'X-Request-ID';
+my $header_value = '77e1c83b-7bb0-437b-bc50-a7a58e5660ac';
+my $wrapped_app =
+  Plack::Test->create( $middleware->wrap( $app, context => [ 'Content-Type', 'X-B3-TraceId', $header_name ] ) );
+
+$wrapped_app->request( GET '/' );
+is_deeply $logger->msgs, $messages, 'check Log::Any global log buffer (root logger based logging)';
+is scalar %{ Log::Any->get_logger( category => $category )->context }, 0, 'empty logging context';
+
+$logger->clear;
+
+$wrapped_app->request( GET '/', $header_name => $header_value );
+is_deeply $logger->msgs,
+  [ map { $_->{ message } = $_->{ message } . " {\"$header_name\" => \"$header_value\"}"; $_ } @$messages ],
+  'check Log::Any global log buffer';
+is scalar %{ Log::Any->get_logger( category => $category )->context }, 0, 'empty logging context';
diff --git a/t/release-pod-coverage.t b/t/release-pod-coverage.t
deleted file mode 100644
index 3a81849..0000000
--- a/t/release-pod-coverage.t
+++ /dev/null
@@ -1,21 +0,0 @@
-#!perl
-
-BEGIN {
-  unless ($ENV{RELEASE_TESTING}) {
-    require Test::More;
-    Test::More::plan(skip_all => 'these tests are for release candidate testing');
-  }
-}
-
-
-use Test::More;
-
-eval "use Test::Pod::Coverage 1.08";
-plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
-  if $@;
-
-eval "use Pod::Coverage::TrustPod";
-plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
-  if $@;
-
-all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
diff --git a/t/release-pod-syntax.t b/t/release-pod-syntax.t
deleted file mode 100644
index d46a955..0000000
--- a/t/release-pod-syntax.t
+++ /dev/null
@@ -1,15 +0,0 @@
-#!perl
-
-BEGIN {
-  unless ($ENV{RELEASE_TESTING}) {
-    require Test::More;
-    Test::More::plan(skip_all => 'these tests are for release candidate testing');
-  }
-}
-
-use Test::More;
-
-eval "use Test::Pod 1.41";
-plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
-
-all_pod_files_ok();
diff --git a/t/simple.t b/t/simple.t
deleted file mode 100755
index 33030fb..0000000
--- a/t/simple.t
+++ /dev/null
@@ -1,32 +0,0 @@
-#!env perl
-
-use strict;
-use HTTP::Request::Common;
-use Log::Any::Test;
-use Log::Any qw{$log};
-use Plack::Middleware::LogAny;
-use Plack::Test;
-use Test::More;
-use Try::Tiny;
-
-my $messages = [{category => 'plack.test', level => "debug", message => "This is debug"},
-                {category => 'plack.test', level => "info", message => "This is info"}];
-
-my $app = sub {
-    my ($env) = @_;
-    map { $env->{'psgix.logger'}->($_) } @{$messages};
-    return [200, [], []];
-};
-
-$app = Plack::Middleware::LogAny->wrap ($app, category => 'plack.test');
-
-test_psgi $app, sub {
-    my ($cb) = @_;
-    my $res = $cb->(GET "/");
-    is_deeply ($log->msgs, $messages);
-};
-
-done_testing;
-
-
-

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/share/doc/libplack-middleware-logany-perl/changelog.gz
-rw-r--r--  root/root   /usr/share/perl5/Plack/Middleware/LogAny.pod

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/share/doc/libplack-middleware-logany-perl/README

No differences were encountered in the control files

More details

Full run details