Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fix undefined issue while logging from node-loggly-bulk library #11
Conversation
|
I have tested below scenarios with both node-loggly-bulk and winston-loggly-bulk libraries.
|
|
When you test sending JSON, does Loggly parse the JSON automatically? |
|
@mostlyjason Yes, Loggly parsed the JSON with both node-loggly-bulk and winston-loggly-bulk libraries. See the below examples with parsed JSON screenshots. winston-loggly-bulk library: I am sending JSON data:
JSON parsed result on Loggly: node-loggly-bulk library: I am sending JSON data:
JSON parsed result on Loggly: |
I debugged code with
node-loggly-bulklibrary and found that type ofmsgis a string which should be an object(winston-loggly-bulklibrary is sending log data tonode-loggly-bulkin object form). That's why the value ofmsg.messageobject wasundefined.From node version 7.0.0, node will throw an error when we will pass invalid input to Buffer.byteLength.
Ref: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V7.md#7.0.0
Merged PR: nodejs/node#8946
In this PR I have put a condition to check if the
msgis a string (If we are logging usingnode-loggly-bulk) and then converting to an object. So both library will work correctly.It will fix the issue #10.