Skip to content

colored like inspect #14

@rolfn

Description

@rolfn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions