RoCat / winston-journald

MIT License
2 stars 5 forks source link

Use systemd-journald's metadata facilities #5

Closed bryanburgers closed 7 years ago

bryanburgers commented 7 years ago

Systemd's journal has metadata built into it. This change passes the metadata that is provided to Winston directly into systemd-journald so that the metadata is logged using the systemd journal's native metadata facilities.

RoCat commented 7 years ago

It seems that sending objects to journald will result in a '[object, Object]' in logs. When reading systemd-journald documentation it seems that "message" should be a "string" or an instance of "Error"

for fields, instead of just using meta as journald fields (limited to some fields, see man systemd.journal-fields command, I put an option to choose if you wan't to concat meta to message or not.

see commit https://github.com/RoCat/winston-journald/commit/d53d6e49a98028b86ea66cf0f801e5a3e4e370d4

bryanburgers commented 7 years ago

Sounds good. Thanks for doing that!

I removed the stringification of the message code because it appeared to me that Winston would always convert whatever I gave it to a string before it got to the transport code.