Hello community,
here is the log from the commit of package perl-Log-Contextual for openSUSE:Factory checked in at 2017-12-08 12:59:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Log-Contextual (Old)
and /work/SRC/openSUSE:Factory/.perl-Log-Contextual.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Log-Contextual"
Fri Dec 8 12:59:26 2017 rev:12 rq:554816 version:0.008000
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Log-Contextual/perl-Log-Contextual.changes 2017-05-25 08:32:26.348161958 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Log-Contextual.new/perl-Log-Contextual.changes 2017-12-08 12:59:28.341168551 +0100
@@ -1,0 +2,12 @@
+Sat Nov 25 06:34:05 UTC 2017 - coolo@suse.com
+
+- updated to 0.008000
+ see /usr/share/doc/packages/perl-Log-Contextual/Changes
+
+ 0.008000 2017-11-24 08:40:15-08:00 America/Los_Angeles
+ - Add slog for logging strings without a code block
+ (Thanks Christian Walde!)
+ - Fix exporting into classes that subclass from users of Log::Contextual.
+ (Thanks Graham Knop!)
+
+-------------------------------------------------------------------
Old:
----
Log-Contextual-0.007001.tar.gz
New:
----
Log-Contextual-0.008000.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Log-Contextual.spec ++++++
--- /var/tmp/diff_new_pack.uQfPvc/_old 2017-12-08 12:59:29.133139949 +0100
+++ /var/tmp/diff_new_pack.uQfPvc/_new 2017-12-08 12:59:29.137139805 +0100
@@ -17,14 +17,14 @@
Name: perl-Log-Contextual
-Version: 0.007001
+Version: 0.008000
Release: 0
%define cpan_name Log-Contextual
Summary: Simple logging interface with a contextual log
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Log-Contextual/
-Source0: http://www.cpan.org/authors/id/F/FR/FREW/%{cpan_name}-%{version}.tar.gz
+Source0: https://cpan.metacpan.org/authors/id/F/FR/FREW/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -44,8 +44,8 @@
* * Efficient
-The logging functions take blocks, so if a log level is disabled, the block
-will not run:
+The default logging functions take blocks, so if a log level is disabled,
+the block will not run:
# the following won't run if debug is off
log_debug { "the new count in the database is " . $rs->count };
@@ -103,6 +103,7 @@
%files -f %{name}.files
%defattr(-,root,root,755)
-%doc Changes CONTRIBUTING LICENSE README
+%doc Changes CONTRIBUTING README
+%license LICENSE
%changelog
++++++ Log-Contextual-0.007001.tar.gz -> Log-Contextual-0.008000.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/Changes new/Log-Contextual-0.008000/Changes
--- old/Log-Contextual-0.007001/Changes 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/Changes 2017-11-24 17:40:16.000000000 +0100
@@ -1,10 +1,16 @@
Revision history for Log-Contextual
+0.008000 2017-11-24 08:40:15-08:00 America/Los_Angeles
+ - Add slog for logging strings without a code block
+ (Thanks Christian Walde!)
+ - Fix exporting into classes that subclass from users of Log::Contextual.
+ (Thanks Graham Knop!)
+
0.007001 2017-05-21 07:49:18-07:00 America/Los_Angeles
-- Stop testing exact bytes produced by Data::Dumper::Concise
+ - Stop testing exact bytes produced by Data::Dumper::Concise
(Thanks for reporting Errietta Kostal)
(Fixes GH#11)
-- Add some documentation about exceptions
+ - Add some documentation about exceptions
(Thanks Kent Fredric!)
0.007000 2016-04-11 21:35:41-07:00 America/Los_Angeles
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/MANIFEST new/Log-Contextual-0.008000/MANIFEST
--- old/Log-Contextual-0.007001/MANIFEST 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/MANIFEST 2017-11-24 17:40:16.000000000 +0100
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.009.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.010.
CONTRIBUTING
Changes
LICENSE
@@ -30,6 +30,7 @@
t/easy.t
t/eg.t
t/has_logger.t
+t/inherit.t
t/lib/BaseLogger.pm
t/lib/DefaultImportLogger.pm
t/lib/My/Module.pm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/META.json new/Log-Contextual-0.008000/META.json
--- old/Log-Contextual-0.007001/META.json 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/META.json 2017-11-24 17:40:16.000000000 +0100
@@ -4,7 +4,7 @@
"Arthur Axel \"fREW\" Schmidt "
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010",
+ "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
@@ -51,7 +51,7 @@
"web" : "https://github.com/frioux/Log-Contextual"
}
},
- "version" : "0.007001",
- "x_serialization_backend" : "Cpanel::JSON::XS version 3.023"
+ "version" : "0.008000",
+ "x_serialization_backend" : "Cpanel::JSON::XS version 3.0239"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/META.yml new/Log-Contextual-0.008000/META.yml
--- old/Log-Contextual-0.007001/META.yml 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/META.yml 2017-11-24 17:40:16.000000000 +0100
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010'
+generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,5 +23,5 @@
bugtracker: https://github.com/frioux/Log-Contextual/issues
homepage: https://github.com/frioux/Log-Contextual
repository: https://github.com/frioux/Log-Contextual.git
-version: '0.007001'
+version: '0.008000'
x_serialization_backend: 'YAML::Tiny version 1.70'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/Makefile.PL new/Log-Contextual-0.008000/Makefile.PL
--- old/Log-Contextual-0.007001/Makefile.PL 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/Makefile.PL 2017-11-24 17:40:16.000000000 +0100
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.009.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.010.
use strict;
use warnings;
@@ -25,7 +25,7 @@
"TEST_REQUIRES" => {
"Test::Fatal" => 0
},
- "VERSION" => "0.007001",
+ "VERSION" => "0.008000",
"test" => {
"TESTS" => "t/*.t"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/README new/Log-Contextual-0.008000/README
--- old/Log-Contextual-0.007001/README 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/README 2017-11-24 17:40:16.000000000 +0100
@@ -2,7 +2,7 @@
Log::Contextual - Simple logging interface with a contextual log
VERSION
- version 0.007001
+ version 0.008000
SYNOPSIS
use Log::Contextual qw( :log :dlog set_logger with_logger );
@@ -28,7 +28,7 @@
log_trace { 'foo entered' };
my ($foo, $bar) = Dlog_trace { "params for foo: $_" } @args;
# ...
- log_trace { 'foo left' };
+ slog_trace 'foo left';
};
}
@@ -54,8 +54,8 @@
* Efficient
- The logging functions take blocks, so if a log level is disabled, the
- block will not run:
+ The default logging functions take blocks, so if a log level is
+ disabled, the block will not run:
# the following won't run if debug is off
log_debug { "the new count in the database is " . $rs->count };
@@ -303,6 +303,13 @@
Note: "log_fatal" does not call "die" for you, see "EXCEPTIONS AND
ERROR HANDLING"
+ slog_$level
+ Mostly the same as "log_$level", but expects a string as first argument,
+ not a block. Arguments are passed through just the same, but since it's
+ just a string, interpolation of arguments into it must be done manually.
+
+ my @friends = slog_trace 'friends list being generated.', generate_friend_list();
+
logS_$level
Import Tag: ":log"
@@ -318,6 +325,14 @@
See also: "DlogS_$level".
+ slogS_$level
+ Mostly the same as "logS_$level", but expects a string as first
+ argument, not a block. Arguments are passed through just the same, but
+ since it's just a string, interpolation of arguments into it must be
+ done manually.
+
+ my $friend = slogS_trace 'I only have one friend.', friend();
+
Dlog_$level
Import Tag: ":dlog"
@@ -350,6 +365,14 @@
Note: "Dlog_fatal" does not call "die" for you, see "EXCEPTIONS AND
ERROR HANDLING"
+ Dslog_$level
+ Mostly the same as "Dlog_$level", but expects a string as first
+ argument, not a block. Arguments are passed through just the same, but
+ since it's just a string, no interpolation point can be used, instead
+ the Dumper output is appended.
+
+ my @nicks = Dslog_debug "names: ", map $_->value, $frew->names->all;
+
DlogS_$level
Import Tag: ":dlog"
@@ -362,6 +385,15 @@
my $pals_rs = DlogS_debug { "pals resultset: $_" }
$schema->resultset('Pals')->search({ perlers => 1 });
+ DslogS_$level
+ Mostly the same as "DlogS_$level", but expects a string as first
+ argument, not a block. Arguments are passed through just the same, but
+ since it's just a string, no interpolation point can be used, instead
+ the Dumper output is appended.
+
+ my $pals_rs = DslogS_debug "pals resultset: ",
+ $schema->resultset('Pals')->search({ perlers => 1 });
+
LOGGER CODEREF
Anywhere a logger object can be passed, a coderef is accepted. This is
so that the user can use different logger objects based on runtime
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/dist.ini new/Log-Contextual-0.008000/dist.ini
--- old/Log-Contextual-0.007001/dist.ini 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/dist.ini 2017-11-24 17:40:16.000000000 +0100
@@ -2,7 +2,7 @@
author = Arthur Axel "fREW" Schmidt
license = Perl_5
copyright_holder = Arthur Axel "fREW" Schmidt
-version = 0.007001
+version = 0.008000
[NextRelease]
[@Git]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/Easy/Default.pm new/Log-Contextual-0.008000/lib/Log/Contextual/Easy/Default.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/Easy/Default.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/Easy/Default.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::Easy::Default;
-$Log::Contextual::Easy::Default::VERSION = '0.007001';
+$Log::Contextual::Easy::Default::VERSION = '0.008000';
# ABSTRACT: Import all logging methods with WarnLogger as default
use strict;
@@ -34,7 +34,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/Easy/Package.pm new/Log-Contextual-0.008000/lib/Log/Contextual/Easy/Package.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/Easy/Package.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/Easy/Package.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::Easy::Package;
-$Log::Contextual::Easy::Package::VERSION = '0.007001';
+$Log::Contextual::Easy::Package::VERSION = '0.008000';
# ABSTRACT: Import all logging methods with WarnLogger as default package logger
use strict;
@@ -34,7 +34,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router/HasLogger.pm new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router/HasLogger.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router/HasLogger.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router/HasLogger.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::Role::Router::HasLogger;
-$Log::Contextual::Role::Router::HasLogger::VERSION = '0.007001';
+$Log::Contextual::Role::Router::HasLogger::VERSION = '0.008000';
# ABSTRACT: Abstract interface between loggers and logging code blocks
use Moo::Role;
@@ -20,7 +20,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 AUTHOR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router/SetLogger.pm new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router/SetLogger.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router/SetLogger.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router/SetLogger.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::Role::Router::SetLogger;
-$Log::Contextual::Role::Router::SetLogger::VERSION = '0.007001';
+$Log::Contextual::Role::Router::SetLogger::VERSION = '0.008000';
# ABSTRACT: Abstract interface between loggers and logging code blocks
use Moo::Role;
@@ -20,7 +20,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 AUTHOR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router/WithLogger.pm new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router/WithLogger.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router/WithLogger.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router/WithLogger.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::Role::Router::WithLogger;
-$Log::Contextual::Role::Router::WithLogger::VERSION = '0.007001';
+$Log::Contextual::Role::Router::WithLogger::VERSION = '0.008000';
# ABSTRACT: Abstract interface between loggers and logging code blocks
use Moo::Role;
@@ -20,7 +20,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 AUTHOR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router.pm new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/Role/Router.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/Role/Router.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::Role::Router;
-$Log::Contextual::Role::Router::VERSION = '0.007001';
+$Log::Contextual::Role::Router::VERSION = '0.008000';
# ABSTRACT: Abstract interface between loggers and logging code blocks
use Moo::Role;
@@ -22,7 +22,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/Router.pm new/Log-Contextual-0.008000/lib/Log/Contextual/Router.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/Router.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/Router.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::Router;
-$Log::Contextual::Router::VERSION = '0.007001';
+$Log::Contextual::Router::VERSION = '0.008000';
# ABSTRACT: Route messages to loggers
use Moo;
@@ -134,6 +134,7 @@
sub handle_log_request {
my ($self, %message_info) = @_;
my $generator = $message_info{message_sub};
+ my $text = $message_info{message_text};
my $args = $message_info{message_args};
my $log_level = $message_info{message_level};
@@ -142,7 +143,7 @@
my @loggers = $self->get_loggers(%message_info)
or return;
- my @log = $generator->(@$args);
+ my @log = defined $text ? ($text) : ($generator->(@$args));
$_->$log_level(@log) for @loggers;
}
@@ -160,7 +161,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 AUTHOR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/SimpleLogger.pm new/Log-Contextual-0.008000/lib/Log/Contextual/SimpleLogger.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/SimpleLogger.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/SimpleLogger.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::SimpleLogger;
-$Log::Contextual::SimpleLogger::VERSION = '0.007001';
+$Log::Contextual::SimpleLogger::VERSION = '0.008000';
# ABSTRACT: Super simple logger made for playing with Log::Contextual
use strict;
@@ -69,7 +69,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/TeeLogger.pm new/Log-Contextual-0.008000/lib/Log/Contextual/TeeLogger.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/TeeLogger.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/TeeLogger.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::TeeLogger;
-$Log::Contextual::TeeLogger::VERSION = '0.007001';
+$Log::Contextual::TeeLogger::VERSION = '0.008000';
# ABSTRACT: Output to more than one logger
use strict;
@@ -54,7 +54,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual/WarnLogger.pm new/Log-Contextual-0.008000/lib/Log/Contextual/WarnLogger.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual/WarnLogger.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual/WarnLogger.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual::WarnLogger;
-$Log::Contextual::WarnLogger::VERSION = '0.007001';
+$Log::Contextual::WarnLogger::VERSION = '0.008000';
# ABSTRACT: logger for libraries using Log::Contextual
use strict;
@@ -129,7 +129,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/lib/Log/Contextual.pm new/Log-Contextual-0.008000/lib/Log/Contextual.pm
--- old/Log-Contextual-0.007001/lib/Log/Contextual.pm 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/lib/Log/Contextual.pm 2017-11-24 17:40:16.000000000 +0100
@@ -1,5 +1,5 @@
package Log::Contextual;
-$Log::Contextual::VERSION = '0.007001';
+$Log::Contextual::VERSION = '0.008000';
# ABSTRACT: Simple logging interface with a contextual log
use strict;
@@ -33,7 +33,9 @@
sub _maybe_export {
my ($spec, $target, $name, $new_code) = @_;
- if (my $code = $target->can($name)) {
+ no strict 'refs';
+ if (defined &{"${target}::${name}"}) {
+ my $code = \&{"${target}::${name}"};
# this will warn
$spec->add_export("&$name", $new_code)
@@ -145,6 +147,18 @@
return @args;
};
}
+ if ($spec->config->{log} || $exports->{"&slog_$level"}) {
+ $exports{slog_} = sub {
+ my ($text, @args) = @_;
+ $router->handle_log_request(
+ %base,
+ caller_package => scalar(caller),
+ message_text => $text,
+ message_args => \@args,
+ );
+ return @args;
+ };
+ }
if ($spec->config->{log} || $exports->{"&logS_$level"}) {
$exports{logS_} = sub (&@) {
my ($code, @args) = @_;
@@ -157,6 +171,18 @@
return $args[0];
};
}
+ if ($spec->config->{log} || $exports->{"&slogS_$level"}) {
+ $exports{slogS_} = sub {
+ my ($text, @args) = @_;
+ $router->handle_log_request(
+ %base,
+ caller_package => scalar(caller),
+ message_text => $text,
+ message_args => \@args,
+ );
+ return $args[0];
+ };
+ }
if ($spec->config->{dlog} || $exports->{"&Dlog_$level"}) {
$exports{Dlog_} = sub (&@) {
my ($code, @args) = @_;
@@ -173,6 +199,21 @@
return @args;
};
}
+ if ($spec->config->{dlog} || $exports->{"&Dslog_$level"}) {
+ $exports{Dslog_} = sub {
+ my ($text, @args) = @_;
+ my $wrapped = sub {
+ $text . (@_ ? Data::Dumper::Concise::Dumper @_ : '()');
+ };
+ $router->handle_log_request(
+ %base,
+ caller_package => scalar(caller),
+ message_sub => $wrapped,
+ message_args => \@args,
+ );
+ return @args;
+ };
+ }
if ($spec->config->{dlog} || $exports->{"&DlogS_$level"}) {
$exports{DlogS_} = sub (&$) {
my ($code, $ref) = @_;
@@ -189,6 +230,21 @@
return $ref;
};
}
+ if ($spec->config->{dlog} || $exports->{"&DslogS_$level"}) {
+ $exports{DslogS_} = sub {
+ my ($text, $ref) = @_;
+ my $wrapped = sub {
+ $text . Data::Dumper::Concise::Dumper($_[0]);
+ };
+ $router->handle_log_request(
+ %base,
+ caller_package => scalar(caller),
+ message_sub => $wrapped,
+ message_args => [$ref],
+ );
+ return $ref;
+ };
+ }
_maybe_export($spec, $importer, $_ . $level, $exports{$_})
for keys %exports;
}
@@ -228,7 +284,7 @@
=head1 VERSION
-version 0.007001
+version 0.008000
=head1 SYNOPSIS
@@ -255,7 +311,7 @@
log_trace { 'foo entered' };
my ($foo, $bar) = Dlog_trace { "params for foo: $_" } @args;
# ...
- log_trace { 'foo left' };
+ slog_trace 'foo left';
};
}
@@ -284,7 +340,7 @@
=item * Efficient
-The logging functions take blocks, so if a log level is disabled, the
+The default logging functions take blocks, so if a log level is disabled, the
block will not run:
# the following won't run if debug is off
@@ -549,6 +605,14 @@
=back
+=head2 slog_$level
+
+Mostly the same as L, but expects a string as first argument,
+not a block. Arguments are passed through just the same, but since it's just a
+string, interpolation of arguments into it must be done manually.
+
+ my @friends = slog_trace 'friends list being generated.', generate_friend_list();
+
=head2 logS_$level
Import Tag: C<:log>
@@ -565,6 +629,14 @@
See also: L.
+=head2 slogS_$level
+
+Mostly the same as L, but expects a string as first argument,
+not a block. Arguments are passed through just the same, but since it's just a
+string, interpolation of arguments into it must be done manually.
+
+ my $friend = slogS_trace 'I only have one friend.', friend();
+
=head2 Dlog_$level
Import Tag: C<:dlog>
@@ -607,6 +679,15 @@
=back
+=head2 Dslog_$level
+
+Mostly the same as L, but expects a string as first argument,
+not a block. Arguments are passed through just the same, but since it's just a
+string, no interpolation point can be used, instead the Dumper output is
+appended.
+
+ my @nicks = Dslog_debug "names: ", map $_->value, $frew->names->all;
+
=head2 DlogS_$level
Import Tag: C<:dlog>
@@ -620,6 +701,16 @@
my $pals_rs = DlogS_debug { "pals resultset: $_" }
$schema->resultset('Pals')->search({ perlers => 1 });
+=head2 DslogS_$level
+
+Mostly the same as L, but expects a string as first argument,
+not a block. Arguments are passed through just the same, but since it's just a
+string, no interpolation point can be used, instead the Dumper output is
+appended.
+
+ my $pals_rs = DslogS_debug "pals resultset: ",
+ $schema->resultset('Pals')->search({ perlers => 1 });
+
=head1 LOGGER CODEREF
Anywhere a logger object can be passed, a coderef is accepted. This is so
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/t/base.t new/Log-Contextual-0.008000/t/base.t
--- old/Log-Contextual-0.007001/t/base.t 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/t/base.t 2017-11-24 17:40:16.000000000 +0100
@@ -13,6 +13,12 @@
main->can("log_$_")->(sub { 'fiSMBoC' });
is($DumbLogger2::var, "[$_] fiSMBoC\n", "$_ works");
+ main->can("slog_$_")->('fiSMBoC');
+ is($DumbLogger2::var, "[$_] fiSMBoC\n", "string $_ works");
+
+ main->can("slog_$_")->('0');
+ is($DumbLogger2::var, "[$_] 0\n", "false string $_ works");
+
my @vars =
main->can("log_$_")->(sub { 'fiSMBoC: ' . $_[1] }, qw{foo bar baz});
is($DumbLogger2::var, "[$_] fiSMBoC: bar\n", "log_$_ works with input");
@@ -21,9 +27,20 @@
"log_$_ passes data through correctly"
);
+ my @svars = main->can("slog_$_")->('fiSMBoC', qw{foo bar baz});
+ is($DumbLogger2::var, "[$_] fiSMBoC\n", "slog_$_ ignores input");
+ ok(
+ eq_array(\@svars, [qw{foo bar baz}]),
+ "slog_$_ passes data through correctly"
+ );
+
my $val = main->can("logS_$_")->(sub { 'fiSMBoC: ' . $_[0] }, 'foo');
is($DumbLogger2::var, "[$_] fiSMBoC: foo\n", "logS_$_ works with input");
is($val, 'foo', "logS_$_ passes data through correctly");
+
+ my $sval = main->can("slogS_$_")->('fiSMBoC', 'foo');
+ is($DumbLogger2::var, "[$_] fiSMBoC\n", "slogS_$_ ignores input");
+ is($val, 'foo', "slogS_$_ passes data through correctly");
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/t/dlog.t new/Log-Contextual-0.008000/t/dlog.t
--- old/Log-Contextual-0.007001/t/dlog.t 2017-05-21 16:49:20.000000000 +0200
+++ new/Log-Contextual-0.008000/t/dlog.t 2017-11-24 17:40:16.000000000 +0100
@@ -31,6 +31,17 @@
"Output for Dlog_$level is correct"
);
+ my @sfoo = main->can("Dslog_$level")->("Look ma, data: ", qw{frew bar baz});
+ ok(
+ eq_array(\@sfoo, [qw{frew bar baz}]),
+ "Dslog_$level passes data through correctly"
+ );
+ is(
+ $var,
+ qq([$level] Look ma, data: "frew"\n"bar"\n"baz"\n),
+ "Output for Dslog_$level is correct"
+ );
+
my $bar =
main->can("DlogS_$level")
->(sub { "Look ma, data: $_" }, [qw{frew bar baz}]);
@@ -47,5 +58,17 @@
@foo = main->can("Dlog_$level")->(sub { "nothing: $_" }, ());
ok(eq_array(\@foo, []), "Dlog_$level passes nothing through correctly");
is($var, "[$level] nothing: ()\n", "Output for Dlog_$level is correct");
+
+ my $sbar =
+ main->can("DslogS_$level")->("Look ma, data: ", [qw{frew bar baz}]);
+ ok(
+ eq_array($sbar, [qw{frew bar baz}]),
+ 'DslogS_trace passes data through correctly'
+ );
+ like(
+ $var,
+ qr(\[$level\] Look ma, data: \[),
+ "Output for DslogS_$level is correct"
+ );
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Log-Contextual-0.007001/t/inherit.t new/Log-Contextual-0.008000/t/inherit.t
--- old/Log-Contextual-0.007001/t/inherit.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Log-Contextual-0.008000/t/inherit.t 2017-11-24 17:40:16.000000000 +0100
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+use Log::Contextual qw(set_logger);
+use Log::Contextual::SimpleLogger;
+
+BEGIN {
+ package MySuperClass;
+ use Log::Contextual qw(:log);
+}
+
+BEGIN {
+ package MyChildClass;
+ BEGIN { our @ISA = qw(MySuperClass) };
+ use Log::Contextual qw(:log);
+
+ sub do_thing {
+ log_error { "child class log" };
+ }
+}
+
+my $last_log;
+set_logger(Log::Contextual::SimpleLogger->new({
+ levels => [qw(error)],
+ coderef => sub { $last_log = shift },
+}));
+
+is exception { MyChildClass->do_thing; }, undef,
+ 'log imports work in child class with exports in parent';
+
+done_testing;