Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logFormat, message incorrect formated #81

Open
kzinevych opened this issue Jul 20, 2018 · 1 comment
Open

logFormat, message incorrect formated #81

kzinevych opened this issue Jul 20, 2018 · 1 comment

Comments

@kzinevych
Copy link

Guy can someone tell me. Had update the winston-papertrail to version 1.0.5 (winston version 3.0.0), and saw interesting thing. 2nd parameter 'message' that came in logFormat, formated like this, example:
'Some message { message: 'Some message', level: 'info' }'
Should it be like this, or not? If yes, how to work with it?
After investigation I found in file /lib/winston-papertrail.js, line:325 (var output = msg;)
That set this duplication msg.

`var output = msg;

// If we don't have a string for the message,
// lets transform it before moving on
if (typeof(output) !== 'string') {
    output = util.inspect(output, false, self.depth, self.colorize);
}

if (meta) {
    if (typeof meta !== 'object') {
        output += ' ' + meta;
    }
    else if (meta) {
        if (this.inlineMeta) {
            output += ' ' + util.inspect(meta, false, self.depth, self.colorize).replace(/[\n\t]\s*/gm, " ");
        }
        else {
            output += '\n' + util.inspect(meta, false, self.depth, self.colorize);
        }
    }
}

this.sendMessage(this.hostname, this.program, level, output, callback);`

How logs should looks like?
How work with colorize? It doesn't work for me.
Maybe someone can share best practice.

Would be apriciate for any help.

@shailesh-kanzariya
Copy link

I am also facing similar issue with winston 3.x and winston-papertrail 1.0.5.
Papertrail sends logs as message = message-string + stringified JSON object.
This reduces log readability and creates distraction.
If I downgrade to winston 2.2.0 then winston-papertrail 1.0.5 send proper logs without stringified JSON object.

Please share updates on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants