TomFrost / Bristol

Insanely configurable logging for Node.js
MIT License
113 stars 19 forks source link

Inconsistent nested field logging with the human formatter #60

Open dandv opened 5 years ago

dandv commented 5 years ago

When logging an object with the human formatter, I see that the output is different in nested object keys and values, vs. root ones:

import log from 'bristol';
log.addTarget('console').withFormatter('human');

const object = {
  rootString: 'key name not quoted, string should be quoted',
  nested: {
    string: 'string is quoted, and so is the key',
    array: [],  // empty array correctly logged
  },
  array: [],  // nothing logged
};

log.info('Unquoted strings', object);

Output:

[2019-05-26 00:30:47] INFO: Inconsistent output (file:///.../bristol.mjs:13)
    rootString: key name not quoted, string should be quoted
    nested: 
        {
            "string": "string is quoted, and so is the key",
            "array": []
        }
    array: 
MarkHerhold commented 5 years ago

In the meantime you could try a different formatter such as palin @dandv

image

plug 😉