Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add linebreaks for window filesystems #17

Open
wants to merge 1 commit into from

3 participants

@DevDavido

On Windows all log entries are written in one line.

@tj tj commented on the diff
lib/log.js
@@ -111,8 +111,8 @@ Log.prototype = {
stream.setEncoding('utf8');
stream.on('data', function(chunk){
buf += chunk;
- if ('\n' != buf[buf.length - 1]) return;
- buf.split('\n').map(function(line){
+ if ('\r\n' != buf[buf.length - 1]) return;
@tj Owner
tj added a note

this isn't correct, you're comparing two chars with one char

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@DevDavido

Okay, but then it could be merged?

@buschtoens

Maybe Windows people could just use a decent editor that displays \n corrently, as Unix LF are the standard for Node.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 5, 2013
  1. @DevDavido
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/log.js
View
6 lib/log.js
@@ -111,8 +111,8 @@ Log.prototype = {
stream.setEncoding('utf8');
stream.on('data', function(chunk){
buf += chunk;
- if ('\n' != buf[buf.length - 1]) return;
- buf.split('\n').map(function(line){
+ if ('\r\n' != buf[buf.length - 1]) return;
@tj Owner
tj added a note

this isn't correct, you're comparing two chars with one char

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ buf.split('\r\n').map(function(line){
if (!line.length) return;
try {
var captures = line.match(/^\[([^\]]+)\] (\w+) (.*)/);
@@ -150,7 +150,7 @@ Log.prototype = {
'[' + new Date + ']'
+ ' ' + levelStr
+ ' ' + msg
- + '\n'
+ + '\r\n'
);
}
},
Something went wrong with that request. Please try again.