0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-03 23:09:17 -05:00

allow "pretty" format for logging into files

ref #88
This commit is contained in:
Alex Kocharin 2014-08-11 08:46:20 +04:00
parent 10433438d0
commit 7e5227e4a1

View file

@ -42,8 +42,12 @@ module.exports.setup = function(logs) {
Logger.emit('error', err) Logger.emit('error', err)
}) })
stream.write = function(obj) { stream.write = function(obj) {
if (target.format === 'pretty') {
dest.write(print(obj.level, obj.msg, obj, false) + '\n')
} else {
dest.write(JSON.stringify(obj, Logger.safeCycles()) + '\n') dest.write(JSON.stringify(obj, Logger.safeCycles()) + '\n')
} }
}
} else { } else {
throw new Error('wrong target type for a log') throw new Error('wrong target type for a log')
} }