You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LogDNA stream deletes properties from record object and such modified object is then passed to any other raw bunyan stream declared after LogDNA stream, resulting in incomplete data logged with other streams.
This is because in JS objects are passed to functions as references. This means that modifying arguments inside the function actually modifies external object, not a local copy (because there is no local copy). Stream driver should not mutate received arguments in any way.
Example:
constbunyan=require('bunyan');/* Basic stream which will get raw data and print it to the console */classSimpleStream{write(record){console.log(record);};}letLogDNAStream=require('logdna-bunyan').BunyanStream;letlogDNA=newLogDNAStream({key: '...apikey...'});varlogger=bunyan.createLogger({name: 'test',streams: [{stream: newSimpleStream(),type: 'raw'},// first: basic stream{stream: logDNA,type: 'raw'},// second: logdna{stream: newSimpleStream(),type: 'raw'},// third: basic stream]});logger.warn('This is a warning');
The above logger instance uses three streams. The first prints to the console, the second is a LogDNAStream, the third prints to the console.
Expected behaviour: object printed to the console with first and third stream is the same.
Result: LogDNAStream stream deleted some properties and later streams receive incomplete record. Actually, the most important fields are deleted, level and the message itself, which makes the log record useless.
The text was updated successfully, but these errors were encountered:
LogDNA stream deletes properties from record object and such modified object is then passed to any other raw bunyan stream declared after LogDNA stream, resulting in incomplete data logged with other streams.
This is because in JS objects are passed to functions as references. This means that modifying arguments inside the function actually modifies external object, not a local copy (because there is no local copy). Stream driver should not mutate received arguments in any way.
Example:
The above logger instance uses three streams. The first prints to the console, the second is a LogDNAStream, the third prints to the console.
Expected behaviour: object printed to the console with first and third stream is the same.
Actual behaviour:
Result: LogDNAStream stream deleted some properties and later streams receive incomplete record. Actually, the most important fields are deleted, level and the message itself, which makes the log record useless.
The text was updated successfully, but these errors were encountered: