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

Customize Message Length in winston graylog? #51

Open
LingboTang opened this issue Sep 21, 2017 · 2 comments
Open

Customize Message Length in winston graylog? #51

LingboTang opened this issue Sep 21, 2017 · 2 comments

Comments

@LingboTang
Copy link

I'm using this package recently and I found a problem that only the first 100 characters of a log message are log to graylog because of this line:

this.graylog2[getMessageLevel(level)](msg.substring(0, 100), msg, meta);

and I have to drill down multiple list to see the entire message. I made a change to get rid of the substring function and then it works for me.

For design perspective, this is a dirty change that I shouldn't made for my project, and I didn't see that there is a way that we can through this in configuration level currently, so I'm asking if someone can wrap it up and give us the option so that we can pass in the message length as a parameter.

@LingboTang
Copy link
Author

It could be changed to:

this.graylog2[getMessageLevel(level)](msg, '', meta);

to enable the full message, but we could give the number of characters as a parameters like:

Graylog2.prototype.log = function(level, msg, msg_len, meta, callback) {
  meta = this.processMeta(prepareMeta(meta, this.staticMeta));
  msg  = this.prelog(msg);

  this.graylog2[getMessageLevel(level)](msg.substring(0, msg_len), msg, meta);
  callback(null, true);
};

Maybe a quick change?

@LingboTang
Copy link
Author

It's more like a feature request that we would like to add short_message/full_message as an option.

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

1 participant