FirePHP4Chrome
FirePHP4Chrome copied to clipboard
Associative arrays are being shown in the console as objects
If I log an associative array, the output is
Object {add: Object, first: Object, second: Object, fourth: Object, third: Object}
I would have expected it to be logged as arrays are.
Unfortunately, since there is "no such thing" in javascript as an associative array, so I can't do this. The reason is not so much as I couldn't use an indicator with the output (meaning, I could transmit an object but flag it as an array), but that the console only logs things that are possible in javascript. Since there is no such thing in javascript, it will create is an object instead.
With this in mind, though, if you have an alternative that I'm not considering, I'm open to input :)
Thanks for the answer, I have just recently switched over from using FirePHP on Firefox, but didn't consider the fact that here we are logging to Chrome Console. On firefox, FirePHP leverages Firebug, I don't know if integrating somehow with Firebug lite ( which works on every browser ) would help, as I don't know if it gives you more control on what you can log.
I've read that you can style logs with CSS, what about using a different color for associative arrays? Not the best solution but a hack that could work :smile:
If they added support for some basic sort of markup in the console, my idea would be to create the markup that represents the logged object and then log the markup.
I'm just throwing random ideas at the problem :smile:
Ok - awesome - thanks for the suggestions. I'll see what I can come up with - its been a while since I've looked at this code. I'll update this ticket when I come up with a good solution. Thanks again!