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

Logging array values #10

Open
endorama opened this issue May 20, 2015 · 0 comments
Open

Logging array values #10

endorama opened this issue May 20, 2015 · 0 comments

Comments

@endorama
Copy link

I've found a wrong behaviour when logging arrays.

I'm logging an object like this:

{ name: 'string',
  energy: 
   { isConsistent: true,
     lastUpdate: '2015-05-20T17:30:00.000Z', },
  hourly: 
   [ 1 value per hour since same day 00:00 ] }

Using the human formatter the object is printed this way:

[2015-05-20 18:24:39] DEBUG:  (/.../index.js:50)
  name: string
  energy: 
      {
          "isConsistent": true,
          "lastUpdate": "2015-05-20T17:30:00.000Z",
      }
  hourly: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

The problem seems to be human.js#L68 where you check for string [object Object] while the string coming from toString() is like [object Object],[object Object],....

Using util.inspect works fine, and is my current workaround ( I defined a custom formatter with only that line changed ). There is some specific reason why has not been used util.inspect? There is some other way in which I can resolve this issue ( apart from stringifing the content before loggin in)?

Thank you for this library and you support :)

kgraves added a commit to kgraves/Bristol that referenced this issue Oct 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants