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

Allow log writer to handle object conversion #788

Closed
mattzuba opened this issue Mar 12, 2014 · 1 comment
Closed

Allow log writer to handle object conversion #788

mattzuba opened this issue Mar 12, 2014 · 1 comment

Comments

@mattzuba
Copy link

Currently the \Slim\Log::log function converts any object passed in to a string and then eventually sends that resulting conversion to the logwriter. I think it would be more beneficial to only do a conversion to string if there is some context to work with and allow the log writer to determine how it wants to handle the object passed if there is no context.

I'm thinking of the case of using other logging solutions like Monolog - It's difficult to take full advantage of passing an object to Monolog without extending the \Slim\Log class and overloading with my own log() function to pass the raw object instead of a typecasted representation.

@silentworks
Copy link
Member

You can easily use monolog with Slim and override the log call in Slim by doing

$app->log = yourOwnLoggerClass;

Take a look at @tuupola comment here #840 you will notice he is using Monolog.

There is another issue relating to this at #851, I will close this in favour of that.

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

2 participants