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

colored like inspect #14

Open
rolfn opened this issue Feb 5, 2019 · 0 comments
Open

colored like inspect #14

rolfn opened this issue Feb 5, 2019 · 0 comments

Comments

@rolfn
Copy link

rolfn commented Feb 5, 2019

Is it possible to show objects (also metadata objects) colored like inspect does? See my example:

const inspect = require('util').inspect;
const bunyan = require('bunyan');
const bunyanDebugStream = require('bunyan-debug-stream');

var logger = bunyan.createLogger({
  name: 'xxx',
  streams: [{
    level: 'debug',
    type: 'raw',
    stream: bunyanDebugStream({
      basepath: __dirname,
      useColor: true,
      showLoggerName: false,
      showProcess: false,
      showPid: false,
      showLevel: true,
      showMetadata: true
    })
  }],
});

const foo = {
  aaa: 'uvw',  
  bbb: 4711,  
  ccc: true,
  ddd: [9,8,7,6]  
}

const inspectOpts = {
  depth:null, colors:true, maxArrayLength:255, breakLength:60, compact:true   
}
console.log(inspect(foo, inspectOpts));
logger.info(foo);

Thanks in advance.

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

No branches or pull requests

1 participant