Skip to content

Instantly share code, notes, and snippets.

/time_piece.diff Secret

Created February 19, 2016 12:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/8c5378857e1d1baab7f8 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojo/Log.pm b/lib/Mojo/Log.pm
index 8b53b8e..0e6c421 100644
--- a/lib/Mojo/Log.pm
+++ b/lib/Mojo/Log.pm
@@ -4,6 +4,7 @@ use Mojo::Base 'Mojo::EventEmitter';
use Carp 'croak';
use Fcntl ':flock';
use Mojo::Util qw(deprecated encode monkey_patch);
+use Time::Piece 'localtime';
has format => sub { \&_format };
has handle => sub {
@@ -56,7 +57,7 @@ sub new {
sub warn { shift->_log(warn => @_) }
sub _format {
- '[' . localtime(shift) . '] [' . shift() . '] ' . join "\n", @_, '';
+ '[' . localtime(shift)->datetime . '] [' . shift() . '] ' . join "\n", @_, '';
}
sub _log { shift->emit('message', shift, @_) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment