winston-papertrail
winston-papertrail copied to clipboard
JSON being appended to the end of the log
How do I get rid of the extra log object?
Bump.... great library btw... would love to know how to fix this as well?
This is due to the changes in Winston v3. The new version in the works in the v2 branch by @ffxsam resolves it.
Still exists. Same problem over here. passing inlineMeta: true
makes it a bit more readable, but it still sucks
I've made few changes on my side, to fix that issue:
in function Papertrail.prototype.log
- if (meta) {
+ if (meta && false) {
This way, the meta information are not appended to the log. It's quite an ugly fix, but the winston v3 change left no other option :( If anyone has a better idea, i'll be delighted to give up that ugly hack
any update on this
Winston v3 includes pretty thorough built-in syslog support. Try using these instructions to switch to one of the new transports (either Syslog or Http).
@markdascher you are doing the greatest job. But is there any way we can just remove this meta from logging
Not that I'm aware of. Winston v3 broke backward compatibility due to this bug, which doesn't seem like it'll ever be fixed: https://github.com/winstonjs/winston-transport/issues/27
That's why we've started recommending the v3 transports mentioned above, when using Winston v3 with Papertrail.
worst work around
new Papertrail({
...configService.get('papertrail'),
inlineMeta: true,
logFormat(level, message) {
let cleanMessage = message.replace(/\s*{\s*context:.*[^']/g, '');
cleanMessage = cleanMessage.replace(/\s*{\s*message:.*[^']/g, '');
return cleanMessage.trim();
},
}),