fgm / filog

A fine logger package for Meteor.JS applications (client + server)
GNU General Public License v3.0
18 stars 6 forks source link

Make syslog output more parseable #33

Closed fgm closed 7 years ago

fgm commented 7 years ago

Currently, the syslog messages being sent are just v8 inspection strings, as the result of util.inspect(doc).

See SyslogSender::send():

    this.syslog.log(level, util.inspect(doc, this.formatOptions));

The reason for this is to ensure data can actually be serialized, and a more common format like JSON does not ensure serializability.

The envisioned strategy is to replace this by an exception-handling JSON stringifying in SyslogSender::send():

Allternative would be to have a user-space serialization library. Some of the envisioned ones are, in more or less decreasing relevance order:

In the longer run, this could mean using the Strategy pattern just like we did at the top level of the logging chain: the initial suggested solution is just a degenerate case of it.

fgm commented 7 years ago

In the suggested change, the serializer now is injectable and provides JSON as a default, now handling non-JSON-serializable data with a fallback to an error format including the util.inspect() blob. There is even a second-level safety fallback for unforeseen cases where util.inspect would fail too.

fgm commented 7 years ago

Changed wording and added server hostname per @yched review.

yched commented 7 years ago

Looks good on our test app :-)

fgm commented 7 years ago

Merged #34

yched commented 7 years ago

Was it merged ? I see nothing in the master history

fgm commented 7 years ago

On dirait que je n'aurais pas du utiliser l'UI de github 😥

Le mar. 11 avr. 2017 13:46, Yves Chedemois notifications@github.com a écrit :

Was it merged ? I see nothing in the master history

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/FGM/filog/issues/33#issuecomment-293232463, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIvz90b9xcT28KwUDrgBKZIMu4mowajks5ru2gigaJpZM4MuIaV .

yched commented 7 years ago

Created a new PR with my local copy of the code from the deleted branch : #35