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

Objects log incorrectly #1

Open
Mat-thieu opened this issue Nov 23, 2015 · 3 comments
Open

Objects log incorrectly #1

Mat-thieu opened this issue Nov 23, 2015 · 3 comments
Assignees

Comments

@Mat-thieu
Copy link

Whenever I log an object all I get is

[object Object]

I fixed this myself by adding this code on line 30

for (var i = arguments.length - 1; i >= 0; i--) {
    if(typeof arguments[i] == 'object' && !Array.isArray(arguments[i]))
        arguments[i] = JSON.stringify(arguments[i]).replace(/"/g, "").replace(/,/g, ', ').replace(/:/g, ': ');
};

This is obviously not the best way to fix this issue, but the use of JSON.stringify might save you some headaches.

This happens in chrome(46.0.2490).

@chinchang
Copy link
Owner

Yes, its on the list. But for now, as mentioned in the example also, you can simple use JSON.stringify.

eg. console.log(JSON.stringify(obj))

@chinchang chinchang self-assigned this Nov 23, 2015
@Mat-thieu
Copy link
Author

@chinchang Aah, my apologies, I think I read over that part :)

@princejwesley
Copy link

We can't use JSON.stringify to convert circular structures.

JSON.stringify(window)

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

3 participants