Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent nested field logging with the human formatter #60

Open
dandv opened this issue May 26, 2019 · 1 comment
Open

Inconsistent nested field logging with the human formatter #60

dandv opened this issue May 26, 2019 · 1 comment

Comments

@dandv
Copy link
Contributor

dandv commented May 26, 2019

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

  • keys are quoted in nested objects, and not quoted in the root
  • string are not quoted if they're values of root fields
  • empty arrays are not logged if they're values of root fields
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: 
@dandv dandv changed the title Inconsistent string quoting with the human formatter Inconsistent nested field logging with the human formatter May 26, 2019
@MarkHerhold
Copy link
Contributor

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

image

#plug 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants