Skip to content

Commit

Permalink
do not make changes to STDERR
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 24, 2013
1 parent de42dd6 commit d808628
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/Log.pm
Expand Up @@ -3,18 +3,18 @@ use Mojo::Base 'Mojo::EventEmitter';

use Carp 'croak';
use Fcntl ':flock';
use Mojo::Util 'encode';

has handle => sub {

# File
if (my $path = shift->path) {
croak qq{Can't open log file "$path": $!}
unless open my $file, '>>:utf8', $path;
unless open my $file, '>>', $path;
return $file;
}

# STDERR
binmode STDERR, ':utf8';
return \*STDERR;
};
has level => 'debug';
Expand Down Expand Up @@ -63,7 +63,7 @@ sub _message {

flock $handle, LOCK_EX;
croak "Can't write to log: $!"
unless $handle->print($self->format($level, @lines));
unless $handle->print(encode 'UTF-8', $self->format($level, @lines));
flock $handle, LOCK_UN;
}

Expand Down

0 comments on commit d808628

Please sign in to comment.