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

Pretty print objects by default #276

Closed
jshbrntt opened this issue May 4, 2016 · 5 comments
Closed

Pretty print objects by default #276

jshbrntt opened this issue May 4, 2016 · 5 comments

Comments

@jshbrntt
Copy link

jshbrntt commented May 4, 2016

If you log out an object by default it is pretty printed to stdout. However, if I do the same with debug it prints a nicely highlighted version of it but squashed.

console.log(config);
// { context: '/Users/synthecypher/dev/app/frontend/scripts',
//   devtool: 'source-map',
//   entry:
//    { alpha: [ './alpha/alpha.module.js' ],
//      beta: [ './beta/beta.module.js' ],
//      gamma: [ './gamma/gamma.module.js' ] },
//   module: { loaders: [ [Object], [Object] ] },
//   output:
//    { filename: '[name].module.js',
//      path: '/Users/synthecypher/dev/app/static/r1197/dist/scripts' },
//   externals: { angular: 'angular' },
//   plugins: [],
//   watch: true }
debug(config);
//  dist-frontend { context: '/Users/synthecypher/dev/app/frontend/scripts', devtool: 'source-map', entry: { alpha: [ './alpha/alpha.module.js' ], beta: [ './beta/beta.module.js' ], gamma: [ './gamma/gamma.module.js' ] }, module: { loaders: [ [Object], [Object] ] }, output: { filename: '[name].module.js', path: '/Users/joshuabarnett/dev/app/static/r1197/dist/scripts' }, externals: { angular: 'angular' }, plugins: [], watch: true } +0ms
@jfexyz
Copy link

jfexyz commented Jun 15, 2016

Yes, it would be awesome to get nested, pretty-printed objects.

@ivan-novakov
Copy link

+1

@TooTallNate
Copy link
Contributor

👍

Maybe we should make %o be the flat version and %O be the pretty version.

Probably for simply debug(obj) as well, though frankly I always use a sprintf formatter as the first argument and %o for printing objects.

Patch welcome!

@TooTallNate
Copy link
Contributor

Breaking change, as proposed, btw. So something for debug@3.

@thebigredgeek
Copy link
Contributor

See #370. Closing

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

5 participants