Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
move logging context configuration to outermost layer
  • Loading branch information
haarg committed Jun 11, 2017
1 parent 5cce45b commit 96ff00d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 11 additions & 0 deletions app.psgi
Expand Up @@ -54,6 +54,17 @@ my $tempdir = "$root_dir/var/tmp";
builder {

enable 'ReverseProxy';
enable sub {
my $app = shift;
sub {
my ($env) = @_;
Log::Log4perl::MDC->put( "ip", $env->{REMOTE_ADDR} );
Log::Log4perl::MDC->put( "method", $env->{REMOTE_METHOD} );
Log::Log4perl::MDC->put( "url", $env->{REQUEST_URI} );
Log::Log4perl::MDC->put( "referer", $env->{HTTP_REFERER} );
$app->($env);
};
};
enable 'Runtime';

unless ( $ENV{HARNESS_ACTIVE} or $0 =~ /\.t$/ ) {
Expand Down
11 changes: 0 additions & 11 deletions lib/MetaCPAN/Web/Controller/Root.pm
Expand Up @@ -19,17 +19,6 @@ MetaCPAN::Web::Controller::Root - Root Controller for MetaCPAN::Web
=head1 METHODS
=head2 auto
=cut

sub auto : Private {
my ( $self, $c ) = @_;
Log::Log4perl::MDC->put( "ip", $c->req->address );
Log::Log4perl::MDC->put( "url", $c->req->uri . '' );
return 1;
}

=head2 index
The root page (/)
Expand Down

0 comments on commit 96ff00d

Please sign in to comment.