Hello community, here is the log from the commit of package perl-Log-Any for openSUSE:Factory checked in at 2017-04-07 14:20:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Log-Any (Old) and /work/SRC/openSUSE:Factory/.perl-Log-Any.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Log-Any" Fri Apr 7 14:20:57 2017 rev:18 rq:483266 version:1.049 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Log-Any/perl-Log-Any.changes 2016-11-14 20:15:42.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Log-Any.new/perl-Log-Any.changes 2017-04-07 14:20:59.612850908 +0200 @@ -1,0 +2,47 @@ +Wed Mar 29 06:02:40 UTC 2017 - [email protected] + +- updated to 1.049 + see /usr/share/doc/packages/perl-Log-Any/Changes + + 1.049 2017-03-28 16:02:10-05:00 America/Chicago + + [Fixed] + + - Fixed failing tests on Windows because of path separator + interpolation. Thanks @nanis [Github #56] + + - Added explicit core dependency on Sys::Syslog in case of Perls + with non-standard core libraries. Thanks @nanis [Github #57] + + 1.048 2017-03-27 15:16:12-05:00 America/Chicago + + - No changes since 1.047 trial release + + 1.047 2017-03-22 20:22:47-05:00 America/Chicago (TRIAL RELEASE) + + [Fixed] + + - Fixed backwards-compatibility with users using the Unix::Syslog + macros in Log::Any::Adapter::Syslog. This requires that the user + have Unix::Syslog installed (which Log::Any does not explicitly + depend on). + + - Log level aliases are now case-insensitive to match the regular + log levels. Prior to this, "WARNING", "Warning", and "warning" + would all work, but "WARN", and "Warn" would not, only "warn". + Thanks to @0x62ash for reporting this issue. [Github #55] + + - Invalid log levels for the File, Stderr, and Stdout adapters now + result in a warning, and the default level of "trace" is used. + Previously, no warning would be issued and no logs would be + generated. Thanks to @0x62ash for reporting this issue. [Github + #55] + + 1.046 2017-01-11 21:22:57-06:00 America/Chicago (TRIAL RELEASE) + + [Added] + + - The Syslog adapter is now part of the core distribution, since it + relies only on core Perl modules. + +------------------------------------------------------------------- Old: ---- Log-Any-1.045.tar.gz New: ---- Log-Any-1.049.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Log-Any.spec ++++++ --- /var/tmp/diff_new_pack.iQqOJA/_old 2017-04-07 14:21:00.448732866 +0200 +++ /var/tmp/diff_new_pack.iQqOJA/_new 2017-04-07 14:21:00.452732300 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Log-Any # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,14 @@ Name: perl-Log-Any -Version: 1.045 +Version: 1.049 Release: 0 %define cpan_name Log-Any Summary: Bringing loggers and listeners together License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Log-Any/ -Source0: http://www.cpan.org/authors/id/P/PR/PREACTION/%{cpan_name}-%{version}.tar.gz +Source0: https://cpan.metacpan.org/authors/id/P/PR/PREACTION/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -88,6 +88,7 @@ %files -f %{name}.files %defattr(-,root,root,755) -%doc Changes CONTRIBUTING.mkdn LICENSE README +%doc Changes CONTRIBUTING.mkdn README +%license LICENSE %changelog ++++++ Log-Any-1.045.tar.gz -> Log-Any-1.049.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/Changes new/Log-Any-1.049/Changes --- old/Log-Any-1.045/Changes 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/Changes 2017-03-28 23:02:15.000000000 +0200 @@ -2,6 +2,47 @@ ** denotes an incompatible change +1.049 2017-03-28 16:02:10-05:00 America/Chicago + + [Fixed] + + - Fixed failing tests on Windows because of path separator + interpolation. Thanks @nanis [Github #56] + + - Added explicit core dependency on Sys::Syslog in case of Perls + with non-standard core libraries. Thanks @nanis [Github #57] + +1.048 2017-03-27 15:16:12-05:00 America/Chicago + + - No changes since 1.047 trial release + +1.047 2017-03-22 20:22:47-05:00 America/Chicago (TRIAL RELEASE) + + [Fixed] + + - Fixed backwards-compatibility with users using the Unix::Syslog + macros in Log::Any::Adapter::Syslog. This requires that the user + have Unix::Syslog installed (which Log::Any does not explicitly + depend on). + + - Log level aliases are now case-insensitive to match the regular + log levels. Prior to this, "WARNING", "Warning", and "warning" + would all work, but "WARN", and "Warn" would not, only "warn". + Thanks to @0x62ash for reporting this issue. [Github #55] + + - Invalid log levels for the File, Stderr, and Stdout adapters now + result in a warning, and the default level of "trace" is used. + Previously, no warning would be issued and no logs would be + generated. Thanks to @0x62ash for reporting this issue. [Github + #55] + +1.046 2017-01-11 21:22:57-06:00 America/Chicago (TRIAL RELEASE) + + [Added] + + - The Syslog adapter is now part of the core distribution, since it + relies only on core Perl modules. + 1.045 2016-11-11 21:52:46-06:00 America/Chicago - No changes from previous (trial) release 1.044 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/LICENSE new/Log-Any-1.049/LICENSE --- old/Log-Any-1.045/LICENSE 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/LICENSE 2017-03-28 23:02:15.000000000 +0200 @@ -1,4 +1,4 @@ -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is Copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. This is free software, licensed under: @@ -272,7 +272,7 @@ --- The Artistic License 1.0 --- -This software is Copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is Copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. This is free software, licensed under: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/MANIFEST new/Log-Any-1.049/MANIFEST --- old/Log-Any-1.045/MANIFEST 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/MANIFEST 2017-03-28 23:02:15.000000000 +0200 @@ -17,6 +17,7 @@ lib/Log/Any/Adapter/Null.pm lib/Log/Any/Adapter/Stderr.pm lib/Log/Any/Adapter/Stdout.pm +lib/Log/Any/Adapter/Syslog.pm lib/Log/Any/Adapter/Test.pm lib/Log/Any/Adapter/Util.pm lib/Log/Any/Manager.pm @@ -44,4 +45,6 @@ t/replace_log.t t/sprintf.t t/stringify.t +t/syslog.t +t/util.t t/valid-methods.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/META.json new/Log-Any-1.049/META.json --- old/Log-Any-1.045/META.json 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/META.json 2017-03-28 23:02:15.000000000 +0200 @@ -3,7 +3,9 @@ "author" : [ "Jonathan Swartz <[email protected]>", "David Golden <[email protected]>", - "Doug Bell <[email protected]>" + "Doug Bell <[email protected]>", + "Daniel Pittman <[email protected]>", + "Stephen Thirlwall <[email protected]>" ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.008, CPAN::Meta::Converter version 2.150010", @@ -42,6 +44,7 @@ "Exporter" : "0", "Fcntl" : "0", "IO::File" : "0", + "Sys::Syslog" : "0", "Test::Builder" : "0", "constant" : "0", "strict" : "0", @@ -64,59 +67,63 @@ "provides" : { "Log::Any" : { "file" : "lib/Log/Any.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Adapter" : { "file" : "lib/Log/Any/Adapter.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Adapter::Base" : { "file" : "lib/Log/Any/Adapter/Base.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Adapter::File" : { "file" : "lib/Log/Any/Adapter/File.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Adapter::Null" : { "file" : "lib/Log/Any/Adapter/Null.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Adapter::Stderr" : { "file" : "lib/Log/Any/Adapter/Stderr.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Adapter::Stdout" : { "file" : "lib/Log/Any/Adapter/Stdout.pm", - "version" : "1.045" + "version" : "1.049" + }, + "Log::Any::Adapter::Syslog" : { + "file" : "lib/Log/Any/Adapter/Syslog.pm", + "version" : "1.049" }, "Log::Any::Adapter::Test" : { "file" : "lib/Log/Any/Adapter/Test.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Adapter::Util" : { "file" : "lib/Log/Any/Adapter/Util.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Manager" : { "file" : "lib/Log/Any/Manager.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Proxy" : { "file" : "lib/Log/Any/Proxy.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Proxy::Null" : { "file" : "lib/Log/Any/Proxy/Null.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Proxy::Test" : { "file" : "lib/Log/Any/Proxy/Test.pm", - "version" : "1.045" + "version" : "1.049" }, "Log::Any::Test" : { "file" : "lib/Log/Any/Test.pm", - "version" : "1.045" + "version" : "1.049" } }, "release_status" : "stable", @@ -131,16 +138,18 @@ "web" : "https://github.com/preaction/Log-Any" } }, - "version" : "1.045", + "version" : "1.049", "x_authority" : "cpan:PREACTION", "x_contributors" : [ "bj5004 <[email protected]>", "cm-perl <[email protected]>", "Lucas Kanashiro <[email protected]>", + "Maros Kollar <[email protected]>", "Maxim Vuets <[email protected]>", "mephinet <[email protected]>", "Philipp Gortan <[email protected]>", - "Stephen Thirlwall <[email protected]>" + "Stephen Thirlwall <[email protected]>", + "Stephen Thirlwall <[email protected]>" ], "x_serialization_backend" : "Cpanel::JSON::XS version 3.0216" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/META.yml new/Log-Any-1.049/META.yml --- old/Log-Any-1.045/META.yml 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/META.yml 2017-03-28 23:02:15.000000000 +0200 @@ -4,6 +4,8 @@ - 'Jonathan Swartz <[email protected]>' - 'David Golden <[email protected]>' - 'Doug Bell <[email protected]>' + - 'Daniel Pittman <[email protected]>' + - 'Stephen Thirlwall <[email protected]>' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' @@ -32,46 +34,49 @@ provides: Log::Any: file: lib/Log/Any.pm - version: '1.045' + version: '1.049' Log::Any::Adapter: file: lib/Log/Any/Adapter.pm - version: '1.045' + version: '1.049' Log::Any::Adapter::Base: file: lib/Log/Any/Adapter/Base.pm - version: '1.045' + version: '1.049' Log::Any::Adapter::File: file: lib/Log/Any/Adapter/File.pm - version: '1.045' + version: '1.049' Log::Any::Adapter::Null: file: lib/Log/Any/Adapter/Null.pm - version: '1.045' + version: '1.049' Log::Any::Adapter::Stderr: file: lib/Log/Any/Adapter/Stderr.pm - version: '1.045' + version: '1.049' Log::Any::Adapter::Stdout: file: lib/Log/Any/Adapter/Stdout.pm - version: '1.045' + version: '1.049' + Log::Any::Adapter::Syslog: + file: lib/Log/Any/Adapter/Syslog.pm + version: '1.049' Log::Any::Adapter::Test: file: lib/Log/Any/Adapter/Test.pm - version: '1.045' + version: '1.049' Log::Any::Adapter::Util: file: lib/Log/Any/Adapter/Util.pm - version: '1.045' + version: '1.049' Log::Any::Manager: file: lib/Log/Any/Manager.pm - version: '1.045' + version: '1.049' Log::Any::Proxy: file: lib/Log/Any/Proxy.pm - version: '1.045' + version: '1.049' Log::Any::Proxy::Null: file: lib/Log/Any/Proxy/Null.pm - version: '1.045' + version: '1.049' Log::Any::Proxy::Test: file: lib/Log/Any/Proxy/Test.pm - version: '1.045' + version: '1.049' Log::Any::Test: file: lib/Log/Any/Test.pm - version: '1.045' + version: '1.049' requires: B: '0' Carp: '0' @@ -79,6 +84,7 @@ Exporter: '0' Fcntl: '0' IO::File: '0' + Sys::Syslog: '0' Test::Builder: '0' constant: '0' strict: '0' @@ -87,14 +93,16 @@ bugtracker: https://github.com/preaction/Log-Any/issues homepage: https://github.com/preaction/Log-Any repository: https://github.com/preaction/Log-Any.git -version: '1.045' +version: '1.049' x_authority: cpan:PREACTION x_contributors: - 'bj5004 <[email protected]>' - 'cm-perl <[email protected]>' - 'Lucas Kanashiro <[email protected]>' + - 'Maros Kollar <[email protected]>' - 'Maxim Vuets <[email protected]>' - 'mephinet <[email protected]>' - 'Philipp Gortan <[email protected]>' - 'Stephen Thirlwall <[email protected]>' + - 'Stephen Thirlwall <[email protected]>' x_serialization_backend: 'YAML::Tiny version 1.69' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/Makefile.PL new/Log-Any-1.049/Makefile.PL --- old/Log-Any-1.045/Makefile.PL 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/Makefile.PL 2017-03-28 23:02:15.000000000 +0200 @@ -8,7 +8,7 @@ my %WriteMakefileArgs = ( "ABSTRACT" => "Bringing loggers and listeners together", - "AUTHOR" => "Jonathan Swartz <swartz\@pobox.com>, David Golden <dagolden\@cpan.org>, Doug Bell <preaction\@cpan.org>", + "AUTHOR" => "Jonathan Swartz <swartz\@pobox.com>, David Golden <dagolden\@cpan.org>, Doug Bell <preaction\@cpan.org>, Daniel Pittman <daniel\@rimspace.net>, Stephen Thirlwall <sdt\@cpan.org>", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, @@ -22,6 +22,7 @@ "Exporter" => 0, "Fcntl" => 0, "IO::File" => 0, + "Sys::Syslog" => 0, "Test::Builder" => 0, "constant" => 0, "strict" => 0, @@ -34,7 +35,7 @@ "IPC::Open3" => 0, "Test::More" => 0 }, - "VERSION" => "1.045", + "VERSION" => "1.049", "test" => { "TESTS" => "t/*.t" } @@ -52,6 +53,7 @@ "IO::File" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, + "Sys::Syslog" => 0, "Test::Builder" => 0, "Test::More" => 0, "constant" => 0, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/README new/Log-Any-1.049/README --- old/Log-Any-1.045/README 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/README 2017-03-28 23:02:15.000000000 +0200 @@ -57,7 +57,7 @@ COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. This is free software; you can redistribute it and/or modify it under diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/cpanfile new/Log-Any-1.049/cpanfile --- old/Log-Any-1.045/cpanfile 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/cpanfile 2017-03-28 23:02:15.000000000 +0200 @@ -4,6 +4,7 @@ requires "Exporter" => "0"; requires "Fcntl" => "0"; requires "IO::File" => "0"; +requires "Sys::Syslog" => "0"; requires "Test::Builder" => "0"; requires "constant" => "0"; requires "strict" => "0"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Base.pm new/Log-Any-1.049/lib/Log/Any/Adapter/Base.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/Base.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Base.pm 2017-03-28 23:02:15.000000000 +0200 @@ -4,7 +4,8 @@ package Log::Any::Adapter::Base; -our $VERSION = '1.045'; +our $VERSION = '1.049'; +our @CARP_NOT = ( 'Log::Any::Adapter' ); # we import these in case any legacy adapter uses them as class methods use Log::Any::Adapter::Util qw/make_method dump_one_line/; @@ -51,7 +52,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 AUTHORS @@ -69,11 +70,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Development.pod new/Log-Any-1.049/lib/Log/Any/Adapter/Development.pod --- old/Log-Any-1.045/lib/Log/Any/Adapter/Development.pod 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Development.pod 2017-03-28 23:02:15.000000000 +0200 @@ -16,7 +16,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -241,11 +241,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/File.pm new/Log-Any-1.049/lib/Log/Any/Adapter/File.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/File.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/File.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Adapter::File; # ABSTRACT: Simple adapter for logging to files -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Config; use Fcntl qw/:flock/; @@ -25,11 +25,15 @@ sub init { my $self = shift; - if ( exists $self->{log_level} ) { - $self->{log_level} = Log::Any::Adapter::Util::numeric_level( $self->{log_level} ) - unless $self->{log_level} =~ /^\d+$/; + if ( exists $self->{log_level} && $self->{log_level} =~ /\D/ ) { + my $numeric_level = Log::Any::Adapter::Util::numeric_level( $self->{log_level} ); + if ( !$numeric_level ) { + require Carp; + Carp::carp( sprintf 'Invalid log level "%s". Defaulting to "%s"', $self->{log_level}, 'trace' ); + } + $self->{log_level} = $numeric_level; } - else { + if ( !$self->{log_level} ) { $self->{log_level} = $trace_level; } my $file = $self->{file}; @@ -76,7 +80,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -128,11 +132,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Null.pm new/Log-Any-1.049/lib/Log/Any/Adapter/Null.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/Null.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Null.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Adapter::Null; # ABSTRACT: Discards all log messages -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Adapter::Base; our @ISA = qw/Log::Any::Adapter::Base/; @@ -33,7 +33,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -65,11 +65,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Stderr.pm new/Log-Any-1.049/lib/Log/Any/Adapter/Stderr.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/Stderr.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Stderr.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Adapter::Stderr; # ABSTRACT: Simple adapter for logging to STDERR -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Adapter::Util (); @@ -16,12 +16,15 @@ sub init { my ($self) = @_; - if ( exists $self->{log_level} ) { - $self->{log_level} = - Log::Any::Adapter::Util::numeric_level( $self->{log_level} ) - unless $self->{log_level} =~ /^\d+$/; + if ( exists $self->{log_level} && $self->{log_level} =~ /\D/ ) { + my $numeric_level = Log::Any::Adapter::Util::numeric_level( $self->{log_level} ); + if ( !$numeric_level ) { + require Carp; + Carp::carp( sprintf 'Invalid log level "%s". Defaulting to "%s"', $self->{log_level}, 'trace' ); + } + $self->{log_level} = $numeric_level; } - else { + if ( !$self->{log_level} ) { $self->{log_level} = $trace_level; } } @@ -59,7 +62,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -102,11 +105,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Stdout.pm new/Log-Any-1.049/lib/Log/Any/Adapter/Stdout.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/Stdout.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Stdout.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Adapter::Stdout; # ABSTRACT: Simple adapter for logging to STDOUT -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Adapter::Util (); @@ -16,12 +16,15 @@ sub init { my ($self) = @_; - if ( exists $self->{log_level} ) { - $self->{log_level} = - Log::Any::Adapter::Util::numeric_level( $self->{log_level} ) - unless $self->{log_level} =~ /^\d+$/; + if ( exists $self->{log_level} && $self->{log_level} =~ /\D/ ) { + my $numeric_level = Log::Any::Adapter::Util::numeric_level( $self->{log_level} ); + if ( !$numeric_level ) { + require Carp; + Carp::carp( sprintf 'Invalid log level "%s". Defaulting to "%s"', $self->{log_level}, 'trace' ); + } + $self->{log_level} = $numeric_level; } - else { + if ( !$self->{log_level} ) { $self->{log_level} = $trace_level; } } @@ -59,7 +62,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -102,11 +105,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Syslog.pm new/Log-Any-1.049/lib/Log/Any/Adapter/Syslog.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/Syslog.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Syslog.pm 2017-03-28 23:02:15.000000000 +0200 @@ -0,0 +1,253 @@ +use 5.008001; +use strict; +use warnings; + +package Log::Any::Adapter::Syslog; + +# ABSTRACT: Send Log::Any logs to syslog +our $VERSION = '1.049'; + +use Log::Any::Adapter::Util qw{make_method}; +use base qw{Log::Any::Adapter::Base}; + +use Sys::Syslog qw( :DEFAULT setlogsock ); +use File::Basename (); + +my $log_params; + + +# Build log level priorities +my @logging_methods = Log::Any->logging_methods; +our %logging_levels; +for my $i (0..@logging_methods-1) { + $logging_levels{$logging_methods[$i]} = $i; +} +# some common typos +$logging_levels{warn} = $logging_levels{warning}; +$logging_levels{inform} = $logging_levels{info}; +$logging_levels{err} = $logging_levels{error}; + +sub _min_level { + my $self = shift; + + return $ENV{LOG_LEVEL} + if $ENV{LOG_LEVEL} && defined $logging_levels{$ENV{LOG_LEVEL}}; + return 'trace' if $ENV{TRACE}; + return 'debug' if $ENV{DEBUG}; + return 'info' if $ENV{VERBOSE}; + return 'error' if $ENV{QUIET}; + return 'trace'; +} + +# When initialized we connect to syslog. +sub init { + my ($self) = @_; + + $self->{name} ||= File::Basename::basename($0) || 'perl'; + $self->{options} ||= "pid"; + $self->{facility} ||= "local7"; + $self->{log_level} ||= $self->{min_level} || $self->_min_level; + + if ( $self->{options} !~ /\D/ ) { + # This is a backwards-compatibility shim from previous versions + # of Log::Any::Adapter::Syslog that relied on Unix::Syslog. + # Unix::Syslog only allowed setting options based on the numeric + # macros exported by Unix::Syslog. These macros are not exported + # by Sys::Syslog (and Sys::Syslog does not accept them). So, we + # map the Unix::Syslog macros onto the equivalent Sys::Syslog + # strings. + eval { require Unix::Syslog; } or die "Unix::Syslog is required to use numeric options"; + my $num_opt = $self->{options}; + my %opt_map = ( + pid => Unix::Syslog::LOG_PID(), + cons => Unix::Syslog::LOG_CONS(), + odelay => Unix::Syslog::LOG_ODELAY(), + ndelay => Unix::Syslog::LOG_NDELAY(), + nowait => Unix::Syslog::LOG_NOWAIT(), + perror => Unix::Syslog::LOG_PERROR(), + ); + $self->{options} = join ",", grep { $num_opt & $opt_map{ $_ } } keys %opt_map; + } + + # We want to avoid re-opening the syslog unnecessarily, so only do it if + # the parameters have changed. + my $new_params = $self->_log_params; + if ((not defined $log_params) or ($log_params ne $new_params)) { + + $log_params = $new_params; + openlog($self->{name}, $self->{options}, $self->{facility}); + } + + return $self; +} + +sub _log_params { + my ($self) = @_; + return sprintf('%s;%s;%s', + $self->{options}, $self->{facility}, $self->{name}); +} + +# Create logging methods: debug, info, etc. +foreach my $method (Log::Any->logging_methods()) { + my $priority = { + trace => "debug", + debug => "debug", + info => "info", + inform => "info", + notice => "notice", + warning => "warning", + warn => "warning", + error => "error", + err => "error", + critical => "critical", + crit => "critical", + fatal => "critical", + alert => "alert", + emergency => "emergency", + }->{$method}; + defined($priority) or $priority = "error"; # unknown, take a guess. + + make_method($method, sub { + my $self = shift; + return if $logging_levels{$method} < + $logging_levels{$self->{log_level}}; + + syslog($priority, join('', @_)) + }); +} + +# Create detection methods: is_debug, is_info, etc. +foreach my $method (Log::Any->detection_methods()) { + my $level = $method; $level =~ s/^is_//; + make_method($method, sub { + my $self = shift; + return $logging_levels{$level} >= $logging_levels{$self->{log_level}}; + }); + +} + + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Log::Any::Adapter::Syslog - Send Log::Any logs to syslog + +=head1 VERSION + +version 1.049 + +=head1 SYNOPSIS + + use Log::Any::Adapter 'Syslog'; + # ... or ... + use Log::Any::Adapter; + Log::Any::Adapter->set('Syslog'); + + # You can override defaults: + Log::Any::Adapter->set( + 'Syslog', + # name defaults to basename($0) + name => 'my-name', + # options default to "pid" + options => "pid,ndelay", + # facility defaults to "local7" + facility => "mail" + ); + +=head1 DESCRIPTION + +L<Log::Any> is a generic adapter for writing logging into Perl modules; this +adapter use the L<Sys::Syslog> module to direct that output into the OS's +logging system (even on Windows). + +=head1 CONFIGURATION + +C<Log::Any::Adapter::Syslog> is designed to work out of the box with no +configuration required; the defaults should be reasonably sensible. + +You can override the default configuration by passing extra arguments to the +C<Log::Any::Adapter> method: + +=over + +=item name + +The I<name> argument defaults to the basename of C<$0> if not supplied, and is +inserted into each line sent to syslog to identify the source. + +=item options + +The I<options> configure the behaviour of syslog; see L<Sys::Syslog> for +details. + +The default is C<"pid">, which includes the PID of the current process after +the process name: + + example-process[2345]: something amazing! + +The most likely addition to that is C<perror> (non-POSIX) which causes +syslog to also send a copy of all log messages to the controlling +terminal of the process. + +=item facility + +The I<facility> determines where syslog sends your messages. The default is +C<local7>, which is not the most useful value ever, but is less bad than +assuming the fixed facilities. + +See L<Sys::Syslog> and L<syslog(3)> for details on the available facilities. + +=item log_level + +Minimum log level. All messages below the selected level will be silently +discarded. Default is debug. + +If LOG_LEVEL environment variable is set, it will be used instead. If TRACE +environment variable is set to true, level will be set to 'trace'. If DEBUG +environment variable is set to true, level will be set to 'debug'. If VERBOSE +environment variable is set to true, level will be set to 'info'.If QUIET +environment variable is set to true, level will be set to 'error'. + +=back + +=head1 AUTHORS + +=over 4 + +=item * + +Jonathan Swartz <[email protected]> + +=item * + +David Golden <[email protected]> + +=item * + +Doug Bell <[email protected]> + +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Test.pm new/Log-Any-1.049/lib/Log/Any/Adapter/Test.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/Test.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Test.pm 2017-03-28 23:02:15.000000000 +0200 @@ -4,7 +4,7 @@ package Log::Any::Adapter::Test; -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Adapter::Util qw/dump_one_line/; use Test::Builder; @@ -218,7 +218,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 AUTHORS @@ -236,11 +236,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter/Util.pm new/Log-Any-1.049/lib/Log/Any/Adapter/Util.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter/Util.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter/Util.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Adapter::Util; # ABSTRACT: Common utility functions for Log::Any -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Exporter; our @ISA = qw/Exporter/; @@ -125,7 +125,7 @@ sub numeric_level { my ($level) = @_; my $canonical = - exists $LOG_LEVEL_ALIASES{$level} ? $LOG_LEVEL_ALIASES{$level} : $level; + exists $LOG_LEVEL_ALIASES{ lc $level } ? $LOG_LEVEL_ALIASES{ lc $level } : $level; return $LOG_LEVELS{ uc($canonical) }; } @@ -241,7 +241,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 DESCRIPTION @@ -341,11 +341,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Adapter.pm new/Log-Any-1.049/lib/Log/Any/Adapter.pm --- old/Log-Any-1.045/lib/Log/Any/Adapter.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Adapter.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,9 +5,10 @@ package Log::Any::Adapter; # ABSTRACT: Tell Log::Any where to send its logs -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any; +our @CARP_NOT = ( 'Log::Any::Manager' ); sub import { my $pkg = shift; @@ -38,7 +39,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -240,11 +241,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Manager.pm new/Log-Any-1.049/lib/Log/Any/Manager.pm --- old/Log-Any-1.045/lib/Log/Any/Manager.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Manager.pm 2017-03-28 23:02:15.000000000 +0200 @@ -4,7 +4,7 @@ package Log::Any::Manager; -our $VERSION = '1.045'; +our $VERSION = '1.049'; sub new { my $class = shift; @@ -241,7 +241,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 AUTHORS @@ -259,11 +259,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Proxy/Null.pm new/Log-Any-1.049/lib/Log/Any/Proxy/Null.pm --- old/Log-Any-1.045/lib/Log/Any/Proxy/Null.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Proxy/Null.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Proxy::Null; # ABSTRACT: Log::Any generator proxy for no adapters -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Adapter::Util (); use Log::Any::Proxy; @@ -57,7 +57,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 AUTHORS @@ -75,11 +75,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Proxy/Test.pm new/Log-Any-1.049/lib/Log/Any/Proxy/Test.pm --- old/Log-Any-1.045/lib/Log/Any/Proxy/Test.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Proxy/Test.pm 2017-03-28 23:02:15.000000000 +0200 @@ -4,7 +4,7 @@ package Log::Any::Proxy::Test; -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Proxy; our @ISA = qw/Log::Any::Proxy/; @@ -42,7 +42,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 AUTHORS @@ -60,11 +60,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Proxy.pm new/Log-Any-1.049/lib/Log/Any/Proxy.pm --- old/Log-Any-1.045/lib/Log/Any/Proxy.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Proxy.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Proxy; # ABSTRACT: Log::Any generator proxy object -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Adapter::Util (); use overload; @@ -115,7 +115,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -261,6 +261,46 @@ Numeric levels range from 0 (emergency) to 8 (trace). Constant functions for these levels are available from L<Log::Any::Adapter::Util>. +=head1 TIPS + +=head2 UTF-8 in Data Structures + +If you have high-bit characters in a data structure being passed to a log +method, Log::Any will output that data structure with the high-bit +characters encoded as C<\x{###}>, Perl's escape sequence for high-bit +characters. This is because the L<Data::Dumper> module escapes those +characters. + + use utf8; + use Log::Any qw( $log ); + my @data = ( "Привет мир" ); # Hello, World! + $log->infof("Got: %s", \@data); + # Got: ["\x{41f}\x{440}\x{438}\x{432}\x{435}\x{442} \x{43c}\x{438}\x{440}"] + +If you want to instead display the actual characters in your log file or +terminal, you can use the L<Data::Dumper::AutoEncode> module. To wire this +up into Log::Any, you must pass a custom C<formatter> sub: + + use utf8; + use Data::Dumper::AutoEncode; + + sub log_formatter { + my ( $category, $level, $format, @params ) = @_; + # Run references through Data::Dumper::AutoEncode + @params = map { ref $_ ? eDumper( $_ ) : $_ } @params; + return sprintf $format, @params; + } + + use Log::Any '$log', formatter => \&log_formatter; + +This formatter changes the output to: + + Got: $VAR1 = [ + 'Привет мир' + ]; + +Thanks to L<@denis-it|https://github.com/denis-it> for this tip! + =head1 AUTHORS =over 4 @@ -277,11 +317,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any/Test.pm new/Log-Any-1.049/lib/Log/Any/Test.pm --- old/Log-Any-1.045/lib/Log/Any/Test.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any/Test.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any::Test; # ABSTRACT: Test what you're logging with Log::Any -our $VERSION = '1.045'; +our $VERSION = '1.049'; no warnings 'once'; $Log::Any::OverrideDefaultAdapterClass = 'Log::Any::Adapter::Test'; @@ -25,7 +25,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -142,11 +142,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/lib/Log/Any.pm new/Log-Any-1.049/lib/Log/Any.pm --- old/Log-Any-1.045/lib/Log/Any.pm 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/lib/Log/Any.pm 2017-03-28 23:02:15.000000000 +0200 @@ -5,7 +5,7 @@ package Log::Any; # ABSTRACT: Bringing loggers and listeners together -our $VERSION = '1.045'; +our $VERSION = '1.049'; use Log::Any::Manager; use Log::Any::Proxy::Null; @@ -133,7 +133,7 @@ =head1 VERSION -version 1.045 +version 1.049 =head1 SYNOPSIS @@ -426,11 +426,19 @@ Doug Bell <[email protected]> +=item * + +Daniel Pittman <[email protected]> + +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 CONTRIBUTORS -=for stopwords bj5004 cm-perl Lucas Kanashiro Maxim Vuets mephinet Philipp Gortan Stephen Thirlwall +=for stopwords bj5004 cm-perl Lucas Kanashiro Maros Kollar Maxim Vuets mephinet Philipp Gortan Stephen Thirlwall =over 4 @@ -448,6 +456,10 @@ =item * +Maros Kollar <[email protected]> + +=item * + Maxim Vuets <[email protected]> =item * @@ -462,11 +474,15 @@ Stephen Thirlwall <[email protected]> +=item * + +Stephen Thirlwall <[email protected]> + =back =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2016 by Jonathan Swartz, David Golden, and Doug Bell. +This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell. 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/t/00-compile.t new/Log-Any-1.049/t/00-compile.t --- old/Log-Any-1.045/t/00-compile.t 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/t/00-compile.t 2017-03-28 23:02:15.000000000 +0200 @@ -6,7 +6,7 @@ use Test::More; -plan tests => 14 + ($ENV{AUTHOR_TESTING} ? 1 : 0); +plan tests => 15 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Log/Any.pm', @@ -16,6 +16,7 @@ 'Log/Any/Adapter/Null.pm', 'Log/Any/Adapter/Stderr.pm', 'Log/Any/Adapter/Stdout.pm', + 'Log/Any/Adapter/Syslog.pm', 'Log/Any/Adapter/Test.pm', 'Log/Any/Adapter/Util.pm', 'Log/Any/Manager.pm', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/t/00-report-prereqs.dd new/Log-Any-1.049/t/00-report-prereqs.dd --- old/Log-Any-1.045/t/00-report-prereqs.dd 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/t/00-report-prereqs.dd 2017-03-28 23:02:15.000000000 +0200 @@ -12,6 +12,7 @@ 'Exporter' => '0', 'Fcntl' => '0', 'IO::File' => '0', + 'Sys::Syslog' => '0', 'Test::Builder' => '0', 'constant' => '0', 'strict' => '0', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/t/filescreen.t new/Log-Any-1.049/t/filescreen.t --- old/Log-Any-1.045/t/filescreen.t 2016-11-12 04:52:51.000000000 +0100 +++ new/Log-Any-1.049/t/filescreen.t 2017-03-28 23:02:15.000000000 +0200 @@ -4,7 +4,8 @@ use File::Temp qw(tempdir); use Log::Any::Adapter::Util qw(cmp_deeply read_file); -plan tests => 16; +plan tests => 25; +my $__FILE__ = quotemeta __FILE__; require Log::Any::Adapter; @@ -26,6 +27,18 @@ Log::Any::Adapter->set({lexically => \my $lex}, 'File', $file); ok( $log->is_trace, "file will log trace lexically" ); } + + { # Test that File adapter validates log level properly + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, $_[0] }; + Log::Any::Adapter->set( {lexically => \my $lex}, 'File', $file, log_level => 'FOOBAR' ); + my $log = Log::Any->get_logger(); + ok( $log->is_trace, "log defaults to trace level" ); + is scalar @warnings, 1, 'one warning issued'; + like $warnings[0], + qr{Invalid log level "FOOBAR"\. Defaulting to "trace" at $__FILE__ line \d+}, + 'warning is correct'; + } } { @@ -44,6 +57,18 @@ Log::Any::Adapter->set({lexically => \my $lex}, 'Stdout'); ok( $log->is_trace, "stdout will log trace lexically" ); } + + { # Test that Stdout adapter validates log level properly + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, $_[0] }; + Log::Any::Adapter->set( {lexically => \my $lex}, 'Stdout', log_level => 'FOOBAR' ); + my $log = Log::Any->get_logger(); + ok( $log->is_trace, "log defaults to trace level" ); + is scalar @warnings, 1, 'one warning issued'; + like $warnings[0], + qr{Invalid log level "FOOBAR"\. Defaulting to "trace" at $__FILE__ line \d+}, + 'warning is correct'; + } } { @@ -62,5 +87,17 @@ Log::Any::Adapter->set({lexically => \my $lex}, 'Stderr'); ok( $log->is_trace, "stderr will log trace lexically" ); } + + { # Test that Stderr adapter validates log level properly + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, $_[0] }; + Log::Any::Adapter->set( {lexically => \my $lex}, 'Stderr', log_level => 'FOOBAR' ); + my $log = Log::Any->get_logger(); + ok( $log->is_trace, "log defaults to trace level" ); + is scalar @warnings, 1, 'one warning issued'; + like $warnings[0], + qr{Invalid log level "FOOBAR"\. Defaulting to "trace" at $__FILE__ line \d+}, + 'warning is correct'; + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/t/syslog.t new/Log-Any-1.049/t/syslog.t --- old/Log-Any-1.045/t/syslog.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Log-Any-1.049/t/syslog.t 2017-03-28 23:02:15.000000000 +0200 @@ -0,0 +1,66 @@ + +use strict; +use warnings; + +use Test::More tests => 27; + +use Log::Any qw{$log}; +use Log::Any::Adapter; +use Log::Any::Adapter::Syslog; + +# Mock the Sys::Syslog classes to behave as we desire. +my @logs; +my @openlogs; +no warnings qw( redefine once ); +local *Log::Any::Adapter::Syslog::openlog = sub { push @openlogs, \@_ }; +local *Log::Any::Adapter::Syslog::syslog = sub { push @logs, \@_ }; +local *Log::Any::Adapter::Syslog::closelog = sub { }; + +Log::Any::Adapter->set('Syslog'); + +my %tests = ( + trace => "debug", + debug => "debug", + info => "info", + notice => "notice", + warning => "warning", + error => "error", + critical => "critical", + alert => "alert", + emergency => "emergency", +); + +for my $level (sort keys %tests) { + my $msg = "${level} level log"; + + $log->$level($msg); + + is $logs[-1][0], $tests{$level}, "Log::Any ${level} maps to the right syslog priority"; + is $logs[-1][1], $msg, "Log::Any passed through the right message"; +} + +# Check that the log was opened +is $openlogs[-1][0], 'syslog.t', 'log opened with correct name'; +is $openlogs[-1][1], 'pid', 'log opened with correct options'; +is $openlogs[-1][2], 'local7', 'log opened with correct facility'; + +# Check that we can open another log +Log::Any::Adapter->set( 'Syslog', + name => 'foo', + options => "pid,perror", + facility => 'user', +); +$log->error( "foo" ); +is $openlogs[-1][0], 'foo', 'log opened with correct name'; +is $openlogs[-1][1], 'pid,perror', 'log opened with correct options'; +is $openlogs[-1][2], 'user', 'log opened with correct facility'; + +# Check that log level works +@logs = (); +Log::Any::Adapter->set( 'Syslog', log_level => 'emergency' ); +$log->error( 'foo' ); +is scalar @logs, 0, 'no log written because log_level too high'; +$log->emergency( 'help' ); +is $logs[-1][0], 'emergency', 'emergency log is logged'; +is $logs[-1][1], 'help', 'emergency log is logged'; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Any-1.045/t/util.t new/Log-Any-1.049/t/util.t --- old/Log-Any-1.045/t/util.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Log-Any-1.049/t/util.t 2017-03-28 23:02:15.000000000 +0200 @@ -0,0 +1,13 @@ + +use strict; +use warnings; + +use Test::More tests => 3; + +use Log::Any::Adapter::Util qw( numeric_level WARNING ); + +### Test that numeric level works with aliases, case-insensitive +is numeric_level( 'warn' ), WARNING(), 'warn alias is correct'; +is numeric_level( 'Warn' ), WARNING(), 'Warn alias is correct'; +is numeric_level( 'WARN' ), WARNING(), 'WARN alias is correct'; +
