Hello community,
here is the log from the commit of package perl-Mojolicious for
openSUSE:Factory checked in at 2019-09-16 10:52:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious"
Mon Sep 16 10:52:40 2019 rev:115 rq:730867 version:8.24
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes
2019-08-13 13:28:05.365310623 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Mojolicious.new.7948/perl-Mojolicious.changes
2019-09-16 10:52:43.239154216 +0200
@@ -1,0 +2,13 @@
+Thu Sep 12 08:00:02 UTC 2019 - <[email protected]>
+
+- updated to 8.24
+ see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+ 8.24 2019-09-11
+ - Added EXPERIMENTAL context method to Mojo::Log.
+ - Added EXPERIMENTAL cleanup event to Mojo::IOLoop::Subprocess.
+ - Added log helper to Mojolicious::Plugin::DefaultHelpers.
+ - Improved log messages generated by Mojolicious to include request ids
when
+ possible
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-8.23.tar.gz
New:
----
Mojolicious-8.24.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.IW2WGP/_old 2019-09-16 10:52:45.347153944 +0200
+++ /var/tmp/diff_new_pack.IW2WGP/_new 2019-09-16 10:52:45.351153942 +0200
@@ -17,7 +17,7 @@
Name: perl-Mojolicious
-Version: 8.23
+Version: 8.24
Release: 0
%define cpan_name Mojolicious
Summary: Real-time web framework
++++++ Mojolicious-8.23.tar.gz -> Mojolicious-8.24.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/Changes new/Mojolicious-8.24/Changes
--- old/Mojolicious-8.23/Changes 2019-08-12 23:54:23.000000000 +0200
+++ new/Mojolicious-8.24/Changes 2019-09-11 22:25:59.000000000 +0200
@@ -1,4 +1,11 @@
+8.24 2019-09-11
+ - Added EXPERIMENTAL context method to Mojo::Log.
+ - Added EXPERIMENTAL cleanup event to Mojo::IOLoop::Subprocess.
+ - Added log helper to Mojolicious::Plugin::DefaultHelpers.
+ - Improved log messages generated by Mojolicious to include request ids when
+ possible
+
8.23 2019-08-12
- Updated Cpanel::JSON::XS requirement to 4.09 for duplicate keys support.
(Grinnz)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/MANIFEST
new/Mojolicious-8.24/MANIFEST
--- old/Mojolicious-8.23/MANIFEST 2019-08-13 00:50:48.000000000 +0200
+++ new/Mojolicious-8.24/MANIFEST 2019-09-12 00:32:28.000000000 +0200
@@ -296,6 +296,7 @@
t/mojolicious/lib/PluginWithTemplate.pm
t/mojolicious/lib/SingleFileTestApp.pm
t/mojolicious/lite_app.t
+t/mojolicious/log_lite_app.t
t/mojolicious/longpolling_lite_app.t
t/mojolicious/mojolicious_config_test.whatever.conf
t/mojolicious/multipath_lite_app.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/META.json
new/Mojolicious-8.24/META.json
--- old/Mojolicious-8.23/META.json 2019-08-13 00:50:48.000000000 +0200
+++ new/Mojolicious-8.24/META.json 2019-09-12 00:32:28.000000000 +0200
@@ -62,6 +62,6 @@
},
"x_IRC" : "irc://irc.freenode.net/#mojo"
},
- "version" : "8.23",
+ "version" : "8.24",
"x_serialization_backend" : "JSON::PP version 4.04"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/META.yml
new/Mojolicious-8.24/META.yml
--- old/Mojolicious-8.23/META.yml 2019-08-13 00:50:48.000000000 +0200
+++ new/Mojolicious-8.24/META.yml 2019-09-12 00:32:28.000000000 +0200
@@ -34,5 +34,5 @@
homepage: https://mojolicious.org
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/mojolicious/mojo.git
-version: '8.23'
+version: '8.24'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/lib/Mojo/IOLoop/Subprocess.pm
new/Mojolicious-8.24/lib/Mojo/IOLoop/Subprocess.pm
--- old/Mojolicious-8.23/lib/Mojo/IOLoop/Subprocess.pm 2019-06-21
22:48:59.000000000 +0200
+++ new/Mojolicious-8.24/lib/Mojo/IOLoop/Subprocess.pm 2019-09-02
20:56:05.000000000 +0200
@@ -38,6 +38,7 @@
$self->ioloop->reset;
my $results = eval { [$self->$child] } || [];
print {$self->{writer}} '0-', $self->serialize->([$@, @$results]);
+ $self->emit('cleanup');
POSIX::_exit(0);
}
@@ -116,6 +117,21 @@
L<Mojo::IOLoop::Subprocess> inherits all events from L<Mojo::EventEmitter> and
can emit the following new ones.
+=head2 cleanup
+
+ $subprocess->on(cleanup => sub {
+ my $subprocess = shift;
+ ...
+ });
+
+Emitted in the subprocess right before the process will exit. Note that this
+event is EXPERIMENTAL and might change without warning!
+
+ $subprocess->on(cleanup => sub {
+ my $subprocess = shift;
+ say "Process $$ is about to exit";
+ });
+
=head2 progress
$subprocess->on(progress => sub {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/lib/Mojo/Log.pm
new/Mojolicious-8.24/lib/Mojo/Log.pm
--- old/Mojolicious-8.23/lib/Mojo/Log.pm 2019-06-21 22:48:48.000000000
+0200
+++ new/Mojolicious-8.24/lib/Mojo/Log.pm 2019-09-11 22:42:58.000000000
+0200
@@ -38,6 +38,12 @@
}
sub debug { 1 >= $LEVEL{$_[0]->level} ? _log(@_, 'debug') : $_[0] }
+
+sub context {
+ my ($self, $str) = @_;
+ return $self->new(parent => $self, context => $str, level => $self->level);
+}
+
sub error { 4 >= $LEVEL{$_[0]->level} ? _log(@_, 'error') : $_[0] }
sub fatal { 5 >= $LEVEL{$_[0]->level} ? _log(@_, 'fatal') : $_[0] }
sub info { 2 >= $LEVEL{$_[0]->level} ? _log(@_, 'info') : $_[0] }
@@ -60,7 +66,12 @@
return "[$time] [$$] [$level] " . join "\n", @_, '';
}
-sub _log { shift->emit('message', pop, ref $_[0] eq 'CODE' ? $_[0]() : @_) }
+sub _log {
+ my ($self, $level) = (shift, pop);
+ my @msgs = ref $_[0] eq 'CODE' ? $_[0]() : @_;
+ $msgs[0] = "$self->{context} $msgs[0]" if $self->{context};
+ ($self->{parent} || $self)->emit('message', $level, @msgs);
+}
sub _message {
my ($self, $level) = (shift, shift);
@@ -199,6 +210,20 @@
Append message to L</"handle">.
+=head2 context
+
+ my $new = $log->context('[extra] [information]');
+
+Construct a new child L<Mojo::Log> object that will include context information
+with every log message. Note that this method is B<EXPERIMENTAL> and might
+change without warning!
+
+ # Log with context
+ my $log = Mojo::Log->new;
+ my $context = $log->context('[17a60115]');
+ $context->debug('This is a log message with context information');
+ $context->info('And another');
+
=head2 debug
$log = $log->debug('You screwed up, but that is ok');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/lib/Mojolicious/Controller.pm
new/Mojolicious-8.24/lib/Mojolicious/Controller.pm
--- old/Mojolicious-8.23/lib/Mojolicious/Controller.pm 2019-06-28
18:11:58.000000000 +0200
+++ new/Mojolicious-8.24/lib/Mojolicious/Controller.pm 2019-09-11
22:25:14.000000000 +0200
@@ -40,7 +40,7 @@
# Cookie too big
my $cookie = {name => $name, value => shift, %{shift || {}}};
- $self->app->log->error(qq{Cookie "$name" is bigger than 4096 bytes})
+ $self->helpers->log->error(qq{Cookie "$name" is bigger than 4096 bytes})
if length $cookie->{value} > 4096;
$self->res->cookies($cookie);
@@ -90,10 +90,10 @@
}
if ($valid) { push @results, $value }
- else { $self->app->log->debug(qq{Cookie "$name" has a bad signature}) }
+ else { $self->helpers->log->debug(qq{Cookie "$name" has bad signature}) }
}
- else { $self->app->log->debug(qq{Cookie "$name" is not signed}) }
+ else { $self->helpers->log->debug(qq{Cookie "$name" is not signed}) }
}
return \@results;
@@ -184,7 +184,7 @@
# Disable auto rendering and stop timer
my $app = $self->render_later->app;
- $app->log->debug(sub {
+ $self->helpers->log->debug(sub {
my $timing = $self->helpers->timing;
my $elapsed = $timing->elapsed('mojo.timer') // 0;
my $rps = $timing->rps($elapsed) // '??';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.23/lib/Mojolicious/Guides/Contributing.pod
new/Mojolicious-8.24/lib/Mojolicious/Guides/Contributing.pod
--- old/Mojolicious-8.23/lib/Mojolicious/Guides/Contributing.pod
2019-08-12 23:51:50.000000000 +0200
+++ new/Mojolicious-8.24/lib/Mojolicious/Guides/Contributing.pod
2019-08-19 16:20:18.000000000 +0200
@@ -79,7 +79,7 @@
opinions and the core team voted for or against a change. To reach the formal
voting stage, a member of the core team needs to endorse the pull request and
call for a vote. You are responsible for securing this endorsement as well as
-the required votes.
+the required votes. The exact L</"Voting Rules"> can be found below.
All code changes should emulate the style of the surrounding code, include
tests
that fail without them, and update relevant documentation.
@@ -92,11 +92,6 @@
now!|https://kiwiirc.com/nextclient/#irc://irc.freenode.net/mojo?nick=guest-?>),
to avoid unnecessary work and to increase its chances of getting accepted.
-Any member of the core team can call for a vote with a GitHub comment
mentioning
-the team C<@mojolicious/core>. Then there will be a review period of 14 days
(or
-less if enough votes have been cast), after which all votes are counted and the
-pull request will be accepted or rejected.
-
The following mission statement and rules are the foundation of all L<Mojo> and
L<Mojolicious> development. Please make sure that your contribution aligns well
with them before sending a pull request.
@@ -120,6 +115,8 @@
=head2 Rules
+General rules for the project:
+
=over 2
Web development should be easy and fun, this is what we optimize for.
@@ -131,28 +128,6 @@
The installation process should be as fast and painless as possible. (Less than
a minute on most common hardware is a good rule of thumb)
-Any member of the core team can call for a vote to decide about the addition
and
-modification of features (usually with a GitHub comment mentioning the team
-C<@mojolicious/core> and the C<vote> label).
-
-A feature can be added or mofified when at least 3 voting members of the core
-team have cast a vote in favour, or the pumpkin-holder overruled the vote.
-
-A vote ends once enough votes have been cast, or after 14 a day review period
-has passed.
-
-Votes for pull requests on GitHub need to be cast with the final code review
-comment and spelled out as C<+1>, C<-1> or C<neutral>. A C<+1> vote may only be
-cast in combination with an approved code review.
-
-For especially controversial decisions it is also possible to call for a
-majority vote.
-
-Any core team member may nominate new members, who must then be accepted by a
-2/3 majority vote.
-
-The pumpkin-holder has veto rights and may select their successor.
-
It's not a feature without a test and documentation.
A feature is only needed when the majority of the user base benefits from it.
@@ -201,6 +176,45 @@
=back
+=head2 Voting Rules
+
+The voting process used to make decisions for the project:
+
+=over 2
+
+Any member of the core team can call for a vote to decide about the addition
and
+modification of features (usually with a GitHub comment mentioning the team
+C<@mojolicious/core> and the C<vote> label).
+
+A feature can be added or modified when at least 3 voting members of the core
+team have cast a vote in favour, or the pumpkin-holder overruled the vote.
+
+A vote ends once enough votes have been cast, or after a 14 day review period
+has passed. Any non-trivial changes (more than a typo fix) will invalidate the
+vote, and require a new vote to be called.
+
+Votes for pull requests on GitHub need to be cast with the final code review
+comment and spelled out as C<+1>, C<-1> or C<neutral>. A C<+1> vote may only be
+cast in combination with an approved code review.
+
+For especially controversial decisions it is also possible to call for a
+majority vote.
+
+Voting is the primary responsibility of the core team, therefore only members
+that participate regularly should be considered active.
+
+Any core team member may nominate new members, who must then be accepted by a
+2/3 majority vote.
+
+Votes should be public if possible, so non-members can participate as well.
+Non-members that regularly have a positive impact on decisions should be
+considered for core team membership.
+
+The pumpkin-holder has veto rights on all decisions and may select their
+successor.
+
+=back
+
=head1 CODE OF CONDUCT
Like the technical community as a whole, the L<Mojolicious> team and community
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.23/lib/Mojolicious/Plugin/DefaultHelpers.pm
new/Mojolicious-8.24/lib/Mojolicious/Plugin/DefaultHelpers.pm
--- old/Mojolicious-8.23/lib/Mojolicious/Plugin/DefaultHelpers.pm
2019-07-07 14:13:07.000000000 +0200
+++ new/Mojolicious-8.24/lib/Mojolicious/Plugin/DefaultHelpers.pm
2019-09-11 22:44:52.000000000 +0200
@@ -42,6 +42,8 @@
$app->helper(dumper => sub { shift; dumper @_ });
$app->helper(include => sub { shift->render_to_string(@_) });
+ $app->helper(log => \&_log);
+
$app->helper('proxy.get_p' => sub { _proxy_method_p('GET', @_) });
$app->helper('proxy.post_p' => sub { _proxy_method_p('POST', @_) });
$app->helper('proxy.start_p' => \&_proxy_start_p);
@@ -95,8 +97,8 @@
sub _development {
my ($page, $c, $e) = @_;
- my $app = $c->app;
- $app->log->error(($e = _is_e($e) ? $e : Mojo::Exception->new($e))->inspect)
+ $c->helpers->log->error(
+ ($e = _is_e($e) ? $e : Mojo::Exception->new($e))->inspect)
if $page eq 'exception';
# Filtered stash snapshot
@@ -106,6 +108,7 @@
$stash->{exception} = $page eq 'exception' ? $e : undef;
# Render with fallbacks
+ my $app = $c->app;
my $mode = $app->mode;
my $options = {
format => $stash->{format} || $app->renderer->default_format,
@@ -167,6 +170,12 @@
return $c->app->static->is_fresh($c, \%options);
}
+sub _log {
+ my $c = shift;
+ return $c->stash->{'mojo.log'}
+ ||= $c->app->log->context('[' . $c->req->request_id . ']');
+}
+
sub _proxy_method_p {
my ($method, $c) = (shift, shift);
return _proxy_start_p($c, $c->ua->build_tx($method, @_));
@@ -254,7 +263,7 @@
sub _static {
my ($c, $file) = @_;
return !!$c->rendered if $c->app->static->serve($c, $file);
- $c->app->log->debug(qq{Static file "$file" not found});
+ $c->helpers->log->debug(qq{Static file "$file" not found});
return !$c->helpers->reply->not_found;
}
@@ -518,6 +527,20 @@
Set C<layout> stash value, all additional key/value pairs get merged into the
L</"stash">.
+=head2 log
+
+ my $log = $c->log;
+
+Alternative to L<Mojolicious/"log"> that includes
+L<Mojo::Message::Request/"request_id"> with every log message.
+
+ # Log message with context
+ $c->log->debug('This is a log message with request id');
+
+ # Pass logger with context to model
+ my $log = $c->log;
+ $c->some_model->create({foo => $foo}, $log);
+
=head2 param
%= param 'foo'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.23/lib/Mojolicious/Plugin/EPLRenderer.pm
new/Mojolicious-8.24/lib/Mojolicious/Plugin/EPLRenderer.pm
--- old/Mojolicious-8.23/lib/Mojolicious/Plugin/EPLRenderer.pm 2019-06-21
22:49:05.000000000 +0200
+++ new/Mojolicious-8.24/lib/Mojolicious/Plugin/EPLRenderer.pm 2019-09-11
22:25:14.000000000 +0200
@@ -15,7 +15,7 @@
# Cached
if ($mt->compiled) {
- $c->app->log->debug("Rendering cached @{[$mt->name]}");
+ $c->helpers->log->debug("Rendering cached @{[$mt->name]}");
$$output = $mt->process(@args);
}
@@ -27,7 +27,7 @@
# Inline
if (defined $inline) {
- $c->app->log->debug(qq{Rendering inline template "$name"});
+ $c->helpers->log->debug(qq{Rendering inline template "$name"});
$$output = $mt->name(qq{inline template "$name"})->render($inline,
@args);
}
@@ -37,19 +37,20 @@
# Try template
if (defined(my $path = $renderer->template_path($options))) {
- $c->app->log->debug(qq{Rendering template "$name"});
+ $c->helpers->log->debug(qq{Rendering template "$name"});
$$output = $mt->name(qq{template "$name"})->render_file($path, @args);
}
# Try DATA section
elsif (defined(my $d = $renderer->get_data_template($options))) {
- $c->app->log->debug(qq{Rendering template "$name" from DATA section});
+ $c->helpers->log->debug(
+ qq{Rendering template "$name" from DATA section});
$$output = $mt->name(qq{template "$name" from DATA section})
->render($d, @args);
}
# No template
- else { $c->app->log->debug(qq{Template "$name" not found}) }
+ else { $c->helpers->log->debug(qq{Template "$name" not found}) }
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/lib/Mojolicious/Renderer.pm
new/Mojolicious-8.24/lib/Mojolicious/Renderer.pm
--- old/Mojolicious-8.23/lib/Mojolicious/Renderer.pm 2019-07-07
14:13:38.000000000 +0200
+++ new/Mojolicious-8.24/lib/Mojolicious/Renderer.pm 2019-09-11
22:25:14.000000000 +0200
@@ -222,7 +222,7 @@
my $handler = $options->{handler} ||= $self->template_handler($options);
return undef unless $handler;
- $c->app->log->error(qq{No handler for "$handler" available}) and return undef
+ $c->helpers->log->error(qq{No handler for "$handler" found}) and return undef
unless my $renderer = $self->handlers->{$handler};
$renderer->($self, $c, $output, $options);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/lib/Mojolicious/Routes.pm
new/Mojolicious-8.24/lib/Mojolicious/Routes.pm
--- old/Mojolicious-8.23/lib/Mojolicious/Routes.pm 2019-06-21
22:49:10.000000000 +0200
+++ new/Mojolicious-8.24/lib/Mojolicious/Routes.pm 2019-09-11
22:25:14.000000000 +0200
@@ -99,9 +99,8 @@
sub _callback {
my ($self, $c, $cb, $last) = @_;
$c->stash->{'mojo.routed'} = 1 if $last;
- my $app = $c->app;
- $app->log->debug('Routing to a callback');
- return _action($app, $c, $cb, $last);
+ $c->helpers->log->debug('Routing to a callback');
+ return _action($c->app, $c, $cb, $last);
}
sub _class {
@@ -125,7 +124,7 @@
elsif ($class) { push @classes, "${_}::$class" for @{$self->namespaces} }
# Try to load all classes
- my $log = $c->app->log;
+ my $log = $c->helpers->log;
for my $class (@classes) {
# Failed
@@ -150,8 +149,7 @@
# Application
my $class = ref $new;
- my $app = $old->app;
- my $log = $app->log;
+ my $log = $old->helpers->log;
if ($new->isa('Mojolicious')) {
$log->debug(qq{Routing to application "$class"});
@@ -171,7 +169,7 @@
if (my $sub = $new->can($method)) {
$old->stash->{'mojo.routed'} = 1 if $last;
- return 1 if _action($app, $new, $sub, $last);
+ return 1 if _action($old->app, $new, $sub, $last);
}
else { $log->debug('Action not found in controller') }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/lib/Mojolicious.pm
new/Mojolicious-8.24/lib/Mojolicious.pm
--- old/Mojolicious-8.23/lib/Mojolicious.pm 2019-07-31 16:18:42.000000000
+0200
+++ new/Mojolicious-8.24/lib/Mojolicious.pm 2019-09-11 22:25:14.000000000
+0200
@@ -59,7 +59,7 @@
has validator => sub { Mojolicious::Validator->new };
our $CODENAME = 'Supervillain';
-our $VERSION = '8.23';
+our $VERSION = '8.24';
sub BUILD_DYNAMIC {
my ($class, $method, $dyn_methods) = @_;
@@ -118,13 +118,12 @@
# Start timer (ignore static files)
my $stash = $c->stash;
- $self->log->debug(sub {
+ $c->helpers->log->debug(sub {
my $req = $c->req;
my $method = $req->method;
my $path = $req->url->path->to_abs_string;
- my $id = $req->request_id;
$c->helpers->timing->begin('mojo.timer');
- return qq{$method "$path" ($id)};
+ return qq{$method "$path"};
}) unless $stash->{'mojo.static'};
# Routes
@@ -147,7 +146,8 @@
$self->plugins->emit_chain(around_dispatch => $c);
# Delayed response
- $self->log->debug('Nothing has been rendered, expecting delayed response')
+ $c->helpers->log->debug(
+ 'Nothing has been rendered, expecting delayed response')
unless $c->stash->{'mojo.rendered'};
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/t/mojo/log.t
new/Mojolicious-8.24/t/mojo/log.t
--- old/Mojolicious-8.23/t/mojo/log.t 2019-05-31 21:28:53.000000000 +0200
+++ new/Mojolicious-8.24/t/mojo/log.t 2019-09-11 22:25:14.000000000 +0200
@@ -172,4 +172,24 @@
ok !$log->is_level('warn'), '"warn" log level is inactive';
ok !$log->is_level('error'), '"error" log level is inactive';
+# Context
+$log = Mojo::Log->new(level => 'warn');
+my $context = $log->context('[123]');
+is $context->level, 'warn';
+$buffer = '';
+{
+ open my $handle, '>', \$buffer;
+ local *STDERR = $handle;
+ my $log = Mojo::Log->new;
+ $context->debug('Fail');
+ $context->error('Just works');
+ $log->warn('No context');
+ $context->fatal('Mojolicious rocks');
+}
+unlike $buffer, qr/\[debug\]/, 'no debug message';
+like $buffer, qr/\[.*\] \[error\] \[123\] Just works\n/, 'right error message';
+like $buffer, qr/\[.*\] \[warn\] No context\n/, 'right warn message';
+like $buffer, qr/\[.*\] \[fatal\] \[123\] Mojolicious rocks\n/,
+ 'right fatal message';
+
done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/t/mojo/subprocess.t
new/Mojolicious-8.24/t/mojo/subprocess.t
--- old/Mojolicious-8.23/t/mojo/subprocess.t 2019-05-31 21:29:01.000000000
+0200
+++ new/Mojolicious-8.24/t/mojo/subprocess.t 2019-09-02 21:07:28.000000000
+0200
@@ -9,6 +9,7 @@
use Mojo::IOLoop;
use Mojo::IOLoop::Subprocess;
+use Mojo::File 'tempfile';
# Huge result
my ($fail, $result, @start);
@@ -202,4 +203,25 @@
[[20], [{percentage => 45}], [{percentage => 90}, {long_data => [1 ..
1e5]}]],
'correct progress';
+# Cleanup
+($fail, $result) = ();
+my $file = tempfile;
+my $called = 0;
+$subprocess = Mojo::IOLoop::Subprocess->new;
+$subprocess->on(
+ cleanup => sub { $file->spurt(shift->serialize->({test => ++$called})) });
+$subprocess->run(
+ sub {'Hello Mojo!'},
+ sub {
+ my ($subprocess, $err, $hello) = @_;
+ $fail = $err;
+ $result = $hello;
+ }
+);
+Mojo::IOLoop->start;
+is_deeply $subprocess->deserialize->($file->slurp), {test => 1},
+ 'cleanup event emitted once';
+ok !$fail, 'no error';
+is $result, 'Hello Mojo!', 'right result';
+
done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/t/mojolicious/group_lite_app.t
new/Mojolicious-8.24/t/mojolicious/group_lite_app.t
--- old/Mojolicious-8.23/t/mojolicious/group_lite_app.t 2019-05-31
21:29:15.000000000 +0200
+++ new/Mojolicious-8.24/t/mojolicious/group_lite_app.t 2019-09-11
22:25:14.000000000 +0200
@@ -268,8 +268,8 @@
$t->get_ok('/bridge2stash')->status_is(200)
->content_is(
"stash too!cookie!!signed_cookie!!bad_cookie--12345678!session!flash!\n");
-like $log, qr/Cookie "foo" is not signed/, 'right message';
-like $log, qr/Cookie "bad" has a bad signature/, 'right message';
+like $log, qr/Cookie "foo" is not signed/, 'right message';
+like $log, qr/Cookie "bad" has bad signature/, 'right message';
ok $t->tx->res->cookie('mojolicious')->httponly,
'session cookie has HttpOnly flag';
is $t->tx->res->cookie('mojolicious')->samesite, 'Lax', 'right SameSite value';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/t/mojolicious/log_lite_app.t
new/Mojolicious-8.24/t/mojolicious/log_lite_app.t
--- old/Mojolicious-8.23/t/mojolicious/log_lite_app.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Mojolicious-8.24/t/mojolicious/log_lite_app.t 2019-09-11
22:25:14.000000000 +0200
@@ -0,0 +1,64 @@
+use Mojo::Base -strict;
+
+BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
+
+use Test::More;
+use Mojolicious::Lite;
+use Mojo::Log;
+use Test::Mojo;
+
+hook before_dispatch => sub {
+ my $c = shift;
+ $c->req->request_id('17a60115');
+};
+
+get '/simple' => sub {
+ my $c = shift;
+ $c->log->debug('First!');
+ $c->log->info('Second!', 'Third!');
+ $c->app->log->debug('No context!');
+ $c->log->warn(sub { 'Fourth!', 'Fifth!' });
+ $c->render(text => 'Simple!');
+};
+
+my $t = Test::Mojo->new;
+
+# Simple log messages with and without context
+my $buffer = '';
+open my $handle, '>', \$buffer;
+$t->app->log(Mojo::Log->new(handle => $handle));
+$t->get_ok('/simple')->status_is(200)->content_is('Simple!');
+like $buffer, qr/First.*Second.*Third.*No context!.*Fourth.*Fifth/s,
+ 'right order';
+like $buffer, qr/\[.+\] \[\d+\] \[debug\] \[17a60115\] First!/,
+ 'message with request id';
+like $buffer, qr/\[.+\] \[\d+\] \[info\] \[17a60115\] Second!\nThird!/s,
+ 'message with request id';
+like $buffer, qr/\[.+\] \[\d+\] \[debug\] No context!/,
+ 'message without request id';
+like $buffer, qr/\[.+\] \[\d+\] \[warn\] \[17a60115\] Fourth!\nFifth!/s,
+ 'message with request id';
+
+# Concurrent requests
+$buffer = '';
+my $first = $t->app->build_controller;
+$first->req->request_id('123-first');
+my $second = $t->app->build_controller;
+$second->req->request_id('123-second');
+$first->log->debug('First!');
+$second->log->debug('Second!');
+$first->log->debug('Third!');
+$second->log->debug('Fourth!');
+$t->app->log->debug('Fifth!');
+like $buffer, qr/First.*Second.*Third.*Fourth.*Fifth/s, 'right order';
+like $buffer, qr/\[.+\] \[\d+\] \[debug\] \[123-first\] First!/,
+ 'message with request id';
+like $buffer, qr/\[.+\] \[\d+\] \[debug\] \[123-second\] Second!/,
+ 'message with request id';
+like $buffer, qr/\[.+\] \[\d+\] \[debug\] \[123-first\] Third!/,
+ 'message with request id';
+like $buffer, qr/\[.+\] \[\d+\] \[debug\] \[123-second\] Fourth!/,
+ 'message with request id';
+like $buffer, qr/\[.+\] \[\d+\] \[debug\] Fifth!/, 'message without request
id';
+
+done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.23/t/mojolicious/renderer.t
new/Mojolicious-8.24/t/mojolicious/renderer.t
--- old/Mojolicious-8.23/t/mojolicious/renderer.t 2019-05-31
21:29:06.000000000 +0200
+++ new/Mojolicious-8.24/t/mojolicious/renderer.t 2019-09-11
22:25:14.000000000 +0200
@@ -49,7 +49,7 @@
my $cb = $c->app->log->on(message => sub { $log .= pop });
$c->stash->{handler} = 'not_defined';
is $renderer->render($c), undef, 'return undef for unrecognized handler';
-like $log, qr/No handler for "not_defined" available/, 'right message';
+like $log, qr/No handler for "not_defined" found/, 'right message';
$c->app->log->unsubscribe(message => $cb);
# Default template name