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

logger callback #130

Closed
wants to merge 2 commits into from
Closed

logger callback #130

wants to merge 2 commits into from

Conversation

lalop
Copy link
Contributor

@lalop lalop commented Jun 10, 2013

ref #126

@girtsu
Copy link

girtsu commented Jun 13, 2013

Hi,
I just started to use Idiorm/Paris, and I really like its lightweightness if compared to other frameworks.
However I noticed a few inconveniences with the logging system. As this thread is currently discussing the logging, I will just add my thoughts here:

  1. There is no possibility to reset the query log - for long running scripts it will consume a lot of memory at some point. Maybe there could be a method that clears log, just like there already is an option to clear the query cache.
    Another option would be to add an optional argument to the get_query_log method that allows to reset the log after each access.
  2. Having a callback function for logging would be a really useful feature. Specifying callback could also turn off the internal logging, to avoid high memory usage.
  3. It would be nice to have a config option that enables to log statements without replacing parameters with values. I see that the _log_query method contains a complicated code that replaces question marks with values. However, for some people it might be enough (or even more suitable for their needs) to log queries without values. It would also improve logging performance.

@lalop
Copy link
Contributor Author

lalop commented Jun 13, 2013

In my point, a good thing could to create a kind of new idiorm version to integrate some breaking change.

Like that we could remove the current logging system to a callback system, letting user keep an array of query if they want. Then we could pass to this callback a kind of query log if the prepared query, params, maybe the execution time ....

That 's not a big work but it's a big change and I don't know if a new version is expected.

@Surt
Copy link
Contributor

Surt commented Jun 26, 2013

+1

@badpenguin
Copy link

i wish to have a log callback providing a pointer to a class that implements an certain interface (i.e. like RedBean does)

@treffynnon
Copy link
Collaborator

There won't be a certain interface to implement just a callback that you
can use to pass the message whereever you choose.

@ghost ghost assigned treffynnon Aug 14, 2013
@treffynnon
Copy link
Collaborator

Thank you for the pull request. All it needs are a couple of tests and some documentation. Then it can be merged!

@treffynnon
Copy link
Collaborator

Merge in commit 32b2220
Documented and tested in commit c842904

@treffynnon treffynnon closed this Aug 28, 2013
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

Successfully merging this pull request may close these issues.

5 participants