jue89 / node-systemd-journald

Native bindings to journald
MIT License
28 stars 10 forks source link

Display instances of Buffer in a nice way #12

Closed jue89 closed 6 years ago

jue89 commented 6 years ago

If buffers are included in the fields object, something like this is put into the journal:

{
...
        "PAYLOAD_0" : "1",
        "PAYLOAD_1" : "2",
        "PAYLOAD_2" : "3",
        "PAYLOAD_3" : "4",
        "PAYLOAD_4" : "5",
        "PAYLOAD_5" : "6",
        "PAYLOAD_6" : "7",
        "PAYLOAD_7" : "8",
        "PAYLOAD_8" : "9",
        "PAYLOAD_9" : "0",
        "PAYLOAD_ASCIISLICE" : "function asciiSlice() { [native code] }",
        "PAYLOAD_BASE64SLICE" : "function base64Slice() { [native code] }",
        "PAYLOAD_LATIN1SLICE" : "function latin1Slice() { [native code] }",
        "PAYLOAD_HEXSLICE" : "function hexSlice() { [native code] }",
        "PAYLOAD_UCS2SLICE" : "function ucs2Slice() { [native code] }",
        "PAYLOAD_UTF8SLICE" : "function utf8Slice() { [native code] }",
        "PAYLOAD_ASCIIWRITE" : "function asciiWrite() { [native code] }",
        "PAYLOAD_BASE64WRITE" : "function base64Write() { [native code] }",
        "PAYLOAD_LATIN1WRITE" : "function latin1Write() { [native code] }",
        "PAYLOAD_HEXWRITE" : "function hexWrite() { [native code] }",
        "PAYLOAD_UCS2WRITE" : "function ucs2Write() { [native code] }",
        "PAYLOAD_UTF8WRITE" : "function utf8Write() { [native code] }",
        "PAYLOAD_COPY" : "function copy() { [native code] }",
...
}

Maybe that's a better way to display them:

{
...
        "PAYLOAD" : "<Buffer 01 02 03 04 05 06 07 08 09 00>",
...
}