Dancer-Logger-PSGI-v1.0.1/0000755000175000017500000000000012310644735015001 5ustar rsimoesrsimoesDancer-Logger-PSGI-v1.0.1/META.yml0000644000175000017500000000143712310644735016257 0ustar rsimoesrsimoes--- abstract: 'PSGI Log handler for Dancer' author: - 'Franck Cuny ' build_requires: Dancer: 1.3059 File::Spec: 0 IO::Handle: 0 IPC::Open3: 0 Module::Build: 0.3601 Plack::Builder: 0 Plack::Loader: 0 Test::More: 0 Test::TCP: 0 configure_requires: Module::Build: 0.3601 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.013, CPAN::Meta::Converter version 2.132830' license: mit meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Dancer-Logger-PSGI requires: Dancer: 1.3059 perl: v5.10.0 resources: bugtracker: https://github.com/rsimoes/dancer-logger-psgi/issues homepage: https://metacpan.org/release/Dancer-Logger-PSGI repository: git://github.com/rsimoes/dancer-logger-psgi.git version: v1.0.1 Dancer-Logger-PSGI-v1.0.1/LICENSE0000644000175000017500000000221212310644735016003 0ustar rsimoesrsimoesThis software is Copyright (c) 2014 by Richard Simões. This is free software, licensed under: The MIT (X11) License The MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Dancer-Logger-PSGI-v1.0.1/Build.PL0000644000175000017500000000260512310644735016300 0ustar rsimoesrsimoes # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.013. use strict; use warnings; use Module::Build 0.3601; my %module_build_args = ( "build_requires" => { "Module::Build" => "0.3601" }, "configure_requires" => { "Module::Build" => "0.3601" }, "dist_abstract" => "PSGI Log handler for Dancer", "dist_author" => [ "Franck Cuny " ], "dist_name" => "Dancer-Logger-PSGI", "dist_version" => "v1.0.1", "license" => "mit", "module_name" => "Dancer::Logger::PSGI", "recommends" => {}, "recursive_test_files" => 1, "requires" => { "Dancer" => "1.3059", "perl" => "v5.10.0" }, "script_files" => [], "test_requires" => { "Dancer" => "1.3059", "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Plack::Builder" => 0, "Plack::Loader" => 0, "Test::More" => 0, "Test::TCP" => 0 } ); my %fallback_build_requires = ( "Dancer" => "1.3059", "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Module::Build" => "0.3601", "Plack::Builder" => 0, "Plack::Loader" => 0, "Test::More" => 0, "Test::TCP" => 0 ); unless ( eval { Module::Build->VERSION(0.4004) } ) { delete $module_build_args{test_requires}; $module_build_args{build_requires} = \%fallback_build_requires; } my $build = Module::Build->new(%module_build_args); $build->create_build_script; Dancer-Logger-PSGI-v1.0.1/lib/0000755000175000017500000000000012310644735015547 5ustar rsimoesrsimoesDancer-Logger-PSGI-v1.0.1/lib/Dancer/0000755000175000017500000000000012310644735016743 5ustar rsimoesrsimoesDancer-Logger-PSGI-v1.0.1/lib/Dancer/Logger/0000755000175000017500000000000012310644735020162 5ustar rsimoesrsimoesDancer-Logger-PSGI-v1.0.1/lib/Dancer/Logger/PSGI.pm0000644000175000017500000000276512310644735021274 0ustar rsimoesrsimoespackage Dancer::Logger::PSGI; use v5.10; use strict; use warnings; use Dancer::SharedData; use parent qw(Dancer::Logger::Abstract); our $VERSION = 'v1.0.1'; # VERSION # ABSTRACT: PSGI Log handler for Dancer sub init { } sub _log { my ($self, $level, $message) = @_; my $full_message = $self->format_message($level => $message); chomp $full_message; my $request = Dancer::SharedData->request; if ( $request->{env}{'psgix.logger'} ) { $request->{env}{'psgix.logger'}->( { level => $level, message => $full_message, } ); } return; } 1; =encoding utf8 =head1 NAME Dancer::Logger::PSGI - PSGI Log handler for Dancer =head1 SYNOPSIS In your Dancer's environment file: logger: PSGI - plack_middlewares: - - ConsoleLogger In your application: warning 'this is a warning'; With L, all your log will be send to the JavaScript console of your browser. =head1 DESCRIPTION This class is an interface between your Dancer's application and B. Message will be logged in whatever logger you decided to use in your L handler. If no logger is defined, nothing will be logged. =head1 AUTHOR Franck Cuny =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Richard Simões . It is released under the terms of the B and may be modified and/or redistributed under the same or any compatible license. Dancer-Logger-PSGI-v1.0.1/Changes0000644000175000017500000000146212310644735016277 0ustar rsimoesrsimoesRevision history for Perl extension Dancer::Logger::PSGI v1.0.1 2014-03-14 13:26:35CDT-0500 America/Chicago - Adjusted distribution package to be processed correctly by metacpan. - Made licensing information consistent. - Removed duplicate tests. v1.0.0 2014-03-13 15:58:30CDT-0500 America/Chicago - Raised minimum version of Perl to v5.10. - Updated git repository location. 0.04 2011-12-24 00:27:35 America/Chicago - Removed usage of Dancer::Request class construction syntax deprecated in Dancer version 1.3059 [Alberto Simões, Fayland Lam] 0.03 2011-02-20 10:27:18 CEST - update SYNOPSIS 0.02 2010-06-20 13:26:57 CEST - better log message [Alexis Sukrieh] 0.01 2010-04-17 12:38:16 CEST - original version Dancer-Logger-PSGI-v1.0.1/MANIFEST0000644000175000017500000000105112310644735016127 0ustar rsimoesrsimoes# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.013. Build.PL Changes LICENSE MANIFEST META.yml README lib/Dancer/Logger/PSGI.pm t/00-compile.t t/01_basic.t t/author-critic.t t/author-pod-spell.t t/author-test-eol.t t/release-cpan-changes.t t/release-dist-manifest.t t/release-distmeta.t t/release-kwalitee.t t/release-minimum-version.t t/release-mojibake.t t/release-no-tabs.t t/release-pod-coverage.t t/release-pod-linkcheck.t t/release-pod-syntax.t t/release-portability.t t/release-test-version.t t/release-unused-vars.t Dancer-Logger-PSGI-v1.0.1/README0000644000175000017500000000045712310644735015667 0ustar rsimoesrsimoes This archive contains the distribution Dancer-Logger-PSGI, version v1.0.1: PSGI Log handler for Dancer This software is Copyright (c) 2014 by Richard Simões. This is free software, licensed under: The MIT (X11) License This README file was generated by Dist::Zilla::Plugin::Readme v5.013. Dancer-Logger-PSGI-v1.0.1/t/0000755000175000017500000000000012310644735015244 5ustar rsimoesrsimoesDancer-Logger-PSGI-v1.0.1/t/author-critic.t0000644000175000017500000000066612310644735020216 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); Dancer-Logger-PSGI-v1.0.1/t/release-test-version.t0000644000175000017500000000110112310644735021502 0ustar rsimoesrsimoes BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 0.002004 BEGIN { eval "use Test::Version; 1;" or die $@; } my @imports = ( 'version_all_ok' ); my $params = { is_strict => 0, has_version => 1, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Dancer-Logger-PSGI-v1.0.1/t/release-minimum-version.t0000644000175000017500000000052612310644735022210 0ustar rsimoesrsimoes#!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::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; all_minimum_version_from_metayml_ok(); Dancer-Logger-PSGI-v1.0.1/t/release-no-tabs.t0000644000175000017500000000060512310644735020413 0ustar rsimoesrsimoes BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::NoTabsTests 0.05 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/Dancer/Logger/PSGI.pm' ); notabs_ok($_) foreach @files; done_testing; Dancer-Logger-PSGI-v1.0.1/t/release-pod-coverage.t0000644000175000017500000000057212310644735021426 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); Dancer-Logger-PSGI-v1.0.1/t/release-kwalitee.t0000644000175000017500000000042412310644735020654 0ustar rsimoesrsimoes BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.07 use strict; use warnings; use Test::Kwalitee; Dancer-Logger-PSGI-v1.0.1/t/release-pod-syntax.t0000644000175000017500000000045612310644735021162 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Dancer-Logger-PSGI-v1.0.1/t/release-unused-vars.t0000644000175000017500000000044512310644735021326 0ustar rsimoesrsimoes#!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::Vars"; plan skip_all => "Test::Vars required for testing unused vars" if $@; all_vars_ok(); Dancer-Logger-PSGI-v1.0.1/t/author-pod-spell.t0000644000175000017500000000072312310644735020632 0ustar rsimoesrsimoes BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006007 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ franck cuny psgi psgix JavaScript Franck Cuny Richard Simões lib Dancer Logger PSGI Dancer-Logger-PSGI-v1.0.1/t/release-dist-manifest.t0000644000175000017500000000046612310644735021624 0ustar rsimoesrsimoes#!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::DistManifest"; plan skip_all => "Test::DistManifest required for testing the manifest" if $@; manifest_ok(); Dancer-Logger-PSGI-v1.0.1/t/author-test-eol.t0000644000175000017500000000047012310644735020466 0ustar rsimoesrsimoes BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::EOL 0.08 use Test::EOL; all_perl_files_ok({ trailing_whitespace => 1 }); Dancer-Logger-PSGI-v1.0.1/t/release-cpan-changes.t0000644000175000017500000000052112310644735021374 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More 0.96 tests => 2; use_ok('Test::CPAN::Changes'); subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; done_testing(); Dancer-Logger-PSGI-v1.0.1/t/release-pod-linkcheck.t0000644000175000017500000000077512310644735021573 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_LINKCHECK ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::LinkCheck"; if ( $@ ) { plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; } else { Test::Pod::LinkCheck->new->all_pod_ok; } Dancer-Logger-PSGI-v1.0.1/t/release-portability.t0000644000175000017500000000053412310644735021413 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings; use Test::More; eval 'use Test::Portability::Files'; plan skip_all => 'Test::Portability::Files required for testing portability' if $@; run_tests(); Dancer-Logger-PSGI-v1.0.1/t/01_basic.t0000644000175000017500000000260312310644735017013 0ustar rsimoesrsimoesuse Test::More import => ['!pass']; use strict; use warnings; plan skip_all => 'LWP::UserAgent is needed to run this test' unless Dancer::ModuleLoader->load('LWP::UserAgent'); plan skip_all => 'Plack::Middleware::ConsoleLogger is needed to run this test' unless Dancer::ModuleLoader->load('Plack::Middleware::ConsoleLogger'); use Plack::Loader; use Plack::Builder; use Test::TCP; Test::TCP::test_tcp( client => sub { my $port = shift; my $ua = LWP::UserAgent->new; my $request = HTTP::Request->new(GET => "http://127.0.0.1:$port/"); my $res = $ua->request($request); ok($res->is_success, "server responded"); like($res->content, qr/this is a warning/, "log message send"); }, server => sub { my $port = shift; use Dancer ':syntax'; setting apphandler => 'PSGI'; setting port => $port; setting access_log => 0; setting logger => "PSGI"; get '/' => sub { warning "this is a warning"; return "this is a test"; }; my $app = sub { my $env = shift; my $request = Dancer::Request->new(env => $env); Dancer->dance($request); }; $app = builder { enable "ConsoleLogger"; $app }; Plack::Loader->auto(port => $port)->run($app); }, ); done_testing; Dancer-Logger-PSGI-v1.0.1/t/release-mojibake.t0000644000175000017500000000064412310644735020634 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use strict; use warnings qw(all); use Test::More; ## no critic (ProhibitStringyEval, RequireCheckingReturnValueOfEval) eval q(use Test::Mojibake); plan skip_all => q(Test::Mojibake required for source encoding testing) if $@; all_files_encoding_ok(); Dancer-Logger-PSGI-v1.0.1/t/release-distmeta.t0000644000175000017500000000043012310644735020656 0ustar rsimoesrsimoes#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. use Test::CPAN::Meta; meta_yaml_ok(); Dancer-Logger-PSGI-v1.0.1/t/00-compile.t0000644000175000017500000000171712310644735017304 0ustar rsimoesrsimoesuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.037 use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Dancer/Logger/PSGI.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; my @warnings; for my $lib (@module_files) { # see L open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};