mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 44 forks source link

stringifyLogObject() : msg set to null cause exception #59

Closed cdupetit closed 6 years ago

cdupetit commented 6 years ago

Hello, In the function stringifyLogObject() when actualLogObject has a type of object, if actualLogObject is not an instance of RegExp, String, Number or Boolean, the function return a new StringifiedLogObject with the first param set to null. This params correspond to the msg member of the class and in some case it cause exception break.

For example for winston.transport.email in the function log :

 var msgOptions = {
    from: this.from,
    to: this.to,
    subject: mustache.render(this.subject, {level: level, msg: msg.split('\n')[0]}),
    text: body,
  }

msg.split() cause an exception. My question : "Is this this normal for the msg param to be set to null ?" Best Regards. Cyril

cdupetit commented 6 years ago

Hello @mperdeck Did you plan any fix on this issue ? Thanks.

mperdeck commented 6 years ago

Sorry for the late reply.

I've changed the code so for objects it will set msg to "" instead of null. This will go out with the next release.

So far, I have been unable to find a specification of the interface of a Winston transport (apart from the existence of the level, msg, meta and callback fields).

cdupetit commented 6 years ago

Thanks.

Envoyé de mon iPhone

Le 27 janv. 2018 à 06:50, mperdeck notifications@github.com<mailto:notifications@github.com> a écrit :

Sorry for the late reply.

I've changed the code so for objects it will set msg to "" instead of null. This will go out with the next release.

So far, I have been unable to find a specification of the interface of a Winston transport (apart from the existence of the level, msg, meta and callback fields).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mperdeck/jsnlog.js/issues/59#issuecomment-360962639, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFxYUo4yq6oeIFdt-_viGZyCAZEh4rpsks5tOrkwgaJpZM4RIkNk.