mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #150] FirePHPHandler Log arrays as Firephp "table" #48
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Surt on GitHub (Jan 18, 2013).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/150
Hi,
Firephp has a good way to render "tables" http://www.firephp.org/HQ/Use.htm
I was triying to figure how to send arrays to a debug message and make it appear as the firephp "table" format. But I ended at line 191 on Logger.php
'message' => (string) $message,.All records are cast to strings? How can I send different types of variables?
@stof commented on GitHub (Jan 18, 2013):
The monolog API is
addRecord(integer|string $level, string $message, array $context). If you want include an array (or an object) in the log record, put it inside the context. You will then see it in Firephp@Surt commented on GitHub (Jan 19, 2013):
Ouch! Thank you and sorry, it was there and I didn't saw it
Finally I managed to create a "dirty" workaround overwriting handle in FirePHPHandler.
It's not so beautiful, but I just use it on developing, so, no performance issues.
using it this way
@Seldaek commented on GitHub (Jan 19, 2013):
@Surt if you think this could be of some value in the core handler I'm not particularly against it, but I don't really use firephp so I am not sure. It seems to me like it's hard to say when something should be a table and when not. I mean it's context dependent, which is hard to solve in an abstraction.
@Surt commented on GitHub (Jan 19, 2013):
Umm I'm not sure, I think that is not a good addition since it breaks a little the uniformity (don't know about other handlers).
Anyway, the issue could stay here for everyone looking for a workaround.
Anyone can drop a comment if they find the post useful.
I use the tables in this way:

by the way ;) Seldaek I can't stop using your Dwoo library. No one makes me feel like it :)
@Seldaek commented on GitHub (Jan 19, 2013):
@Surt eh well, glad to hear but I would really recommend using twig just because dwoo is not going to receive much maintenance ever I'm afraid. And by now twig can do pretty much everything dwoo could besides the automatic php function mapping, but that is in a way for the best in terms of enforcing best practices.
@stof commented on GitHub (Jan 19, 2013):
@Seldaek Twig also has a way to map php functions to Twig functions automatically (but not documented and not recommended)
@Surt commented on GitHub (Jan 19, 2013):
:) I know about Twig, I'm triying to use it but i don't like the syntax and need to rewrite my "plugins" again :(
About the post topic, my last contribution break the headers and nothing except tables appear on the logs, due to the Firephp core code.... so I manage to read the FirePHP Wildfire Wiki and ended with this on the "format" method of WildfireFormatter.php
as always, using it this way, so I can render tables at any level
$log->debug("Benchmark", array('table'=>array(....)));The table array must be non-associative.
This code is better since it lives in the formatter and does not use the FirePHP library in any way (there was no need to use it anyway thanks to your great work)