Comparing version 0.0.6 to 0.0.7
@@ -27,2 +27,4 @@ var logMethods = ['error', 'warn', 'info', 'log', 'trace', 'debug']; | ||
var breakIndent = '\n '; | ||
var format = function (message, type) { | ||
@@ -62,3 +64,2 @@ return type.toUpperCase() + ': ' + message; | ||
prefixes = value; | ||
breakIndent = '\n' + Array((prefixes.log || '').length + 1).join(' '); | ||
}; | ||
@@ -82,2 +83,3 @@ | ||
jsonSpace = value; | ||
breakIndent = '\n' + value; | ||
}; | ||
@@ -94,9 +96,27 @@ | ||
} else { | ||
line = JSON.stringify(line, null, jsonSpace); | ||
line = logger.stringify(line, null, jsonSpace); | ||
} | ||
} | ||
lines.push(line); | ||
lines.push(line.replace(/\n/g, breakIndent)); | ||
} | ||
return lines.join('\n '); | ||
return lines.join(breakIndent); | ||
}; | ||
logger.stringify = function stringify(object) { | ||
try { | ||
Object.defineProperty(object, 'IS_STRINGIFY_INITIATOR', { | ||
enumerable: false, | ||
value: true | ||
}); | ||
} | ||
catch (e) { | ||
} | ||
var isInitiated = false; | ||
var string = JSON.stringify(object, function (key, value) { | ||
value = value.IS_STRINGIFY_INITIATOR && isInitiated ? '[Circular]' : value; | ||
isInitiated = true; | ||
return value; | ||
}, jsonSpace); | ||
delete object.IS_STRINGIFY_INITIATOR; | ||
return string; | ||
}; | ||
@@ -103,0 +123,0 @@ logger.write = function (args, type) { |
@@ -14,7 +14,6 @@ var fs = require('fs'); | ||
var cwd = process.cwd(); | ||
var breakIndent = '\n '; | ||
var specialPattern = /(\.\?\*\+\(\)\[\]\{\}\\)/g; | ||
var escCwd = cwd.replace(specialPattern, '\\$1') + '/'; | ||
var stackPattern = new RegExp( | ||
'\n at ([^\n]*)' + escCwd + '([^:\n]*?)([^\\/:]+):([0-9]+):([0-9]+)([^\n]*)', | ||
'\n +at ([^\n]*)' + escCwd + '([^:\n]*?)([^\\/:]+):([0-9]+):([0-9]+)([^\n]*)', | ||
'g' | ||
@@ -88,5 +87,2 @@ ); | ||
} | ||
else { | ||
string = string.replace(/\n/, breakIndent); | ||
} | ||
return logger.getPrefixes()[type] + string; | ||
@@ -93,0 +89,0 @@ }); |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "cedar.js", | ||
@@ -18,0 +18,0 @@ "homepage": "http://github.com/zerious/cedar", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11940
227