Allow objects to be formatted with `util.inspect` #92

vjpr opened this Issue Aug 26, 2012 · 3 comments


None yet
3 participants

vjpr commented Aug 26, 2012

When passing an object to a logging function, util.inspect allows you to control the recursion depth that it prints an objects properties, and also add colors to the output.

This would be a configuration option for the console appender.

vjpr commented Aug 26, 2012

function formatLogData(logData) should be changed to function formatLogData(logData, config) and a config object should be passed through allowing customisation of the log data. config.inspect.color could allow you to change inspect settings here.

It would also be useful to allow objects to be pretty printed without newlines.

Instead of:

  id: 1
  name: "Foo"

we could have:

id=1 name=Foo 

This would add colors for a start:

output += util.inspect(item, false, 2, true);


nomiddlename commented Jul 17, 2016

layouts use util.format now, so I think this one can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment