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

unable to log nested objects as metadata #19

Closed
jonlb opened this issue Jul 2, 2011 · 5 comments
Closed

unable to log nested objects as metadata #19

jonlb opened this issue Jul 2, 2011 · 5 comments

Comments

@jonlb
Copy link

jonlb commented Jul 2, 2011

I'm not really sure if this is even supposed to be possible but everytime I try to log an object with several layers of nesting it crashes node yet I can util.inspect it just fine.

Here's the object I'm trying to log:

{ project: { basedir: '/home/jon/gits/JxLib', default: 'deploy' },
  app: 
   { name: 'jxlib',
     path: '/jxlib',
     version: '3.0',
     home: '/home/jon/gits/JxLib',
     build: '/home/jon/gits/JxLib/build',
     dist: '/home/jon/gits/JxLib/dist',
     deploy: '/home/jon/gits/JxLib/www',
     docs: '/home/jon/gits/JxLib/www/reference',
     vendor: '/home/jon/gits/JxLib/vendor',
     utils: '/home/jon/gits/JxLib/utils' },
  dependencies: { NaturalDocs: '/home/jon/gits/JxLib/utilsNaturalDocs-1.4/NaturalDocs' },
  loader: 
   { base: { moveImages: false, rewriteImageUrl: false },
     repos: 
      { core: { paths: { js: '/home/jon/gits/JxLib/vendor/mootools-core/Source' } },
        more: { paths: { js: '/home/jon/gits/JxLib/vendor/mootools-more/Source' } },
        jxlib: 
         { paths: 
            { js: '/home/jon/gits/JxLib/build/Source',
              css: '/home/jon/gits/JxLib/build/themes/{theme}/css',
              cssalt: '/home/jon/gits/JxLib/build/themes/{theme}' } } } },
  tasks: [],
  filepath: '/home/jon/gits/JxLib/builder/config.js',
  targets: '/home/jon/gits/JxLib/builder/targets' }

I'm passing it to a logger instance using something like:

logger.debug("log message", obj);

where obj is the one noted above.

is this correct behaviour or is it actually a bug somewhere?

Thanks,
Jon Bomgardner

@indexzero
Copy link
Member

This is a bug

@rgabo
Copy link

rgabo commented Jul 24, 2011

README.md (Logging with Metadata) states that the Console and File transports use util.inspect. which is not the actual case, but rather constructs a single-level deep querystring-like string:(https://github.com/indexzero/winston/blob/master/lib/winston/internal.js#L91)

would be great if internal.log wouldn't be so much internal but customizable (custom formatters?) e.g. output like [level] message would better suit us than level: message, but today we have to fork to achieve this.

still, great work @indexzero, indispensable module in the node community. thanks from @sspinc.

@indexzero
Copy link
Member

@rgabo Agreed. Pull request for this feature would be accepted

@dominictarr
Copy link
Contributor

I tried this and it worked, can you upgrade to latest?

@indexzero
Copy link
Member

Yes. This is fixed in winston@0.4.0

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

4 participants