-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Refactor the logger to a PSR-3 compatible logger #6622
Comments
👍 for using monolog but still keep the API (as mentioned convert to an object instance etc) and not breaking anything Replacing our logger with monolog is on the second place on my "most wanted" todo list and I am looking forward to seeing it in Piwik |
i'm very excited by possibilities of logging Tracker events to various backends in #6209 which kinda requires this new logger first so big 👍 |
I can't wait to use the FingersCrossedHandler ;) |
👍 this looks so useful! |
…screen, database) out of the logger and into the LoggerFactory
…sor" objects (to prepare the transition to Monolog)
…tainerFactory This class can be used in tests to create a specific environment (e.g. the prod environment, CLI environment, etc...)
…Handler This is so the FileHandler can be replaced by Monolog's StreamHandler
…eamHandler We can't remove FileHandler completely because it generates a custom exception message in case of error.
…a processor + added tests Monolog handlers support 1 formatter. Using processors instead of nested formatters leads to much simpler code.
In the tests, logging is disabled. But not when testing the logger itself…
… logging - the error handler logs warnings and notices, and turns errors into exceptions (`ErrorException`) - the exception handler catches all uncatched exceptions and display them to the user (HTML or CLI) - the "screen" logging backend has been removed - I've normalized exceptions/errors shown to the user in HTML (wether they are catched by the FrontController or not)
…L notifications The "screen" backend (WebNotificationHandler) now logs to HTML notification boxes using the `Notification` api. I've re-set the default log level to WARN, and logged PHP notices/warnings to "warning" so that on a default install they are shown in the page in a yellow/warning notification box. For the record, the default log level had previously been changed from WARN to ERROR because screen logging was previously messing the HTML/JSON output (which was breaking archiving). With the logger refactoring this is no longer a problem.
Cannot add tests for the screen backend because I would need to mock the session, which is not possible right now because it's all static stuff.
- log_only_when_cli - log_only_when_debug_parameter
Refactored the logger to use PSR-3 and Monolog (#6622)
The pull request was merged, what is left for me to do:
|
\o/ |
Beautiful! :-) |
Current issues with the logger:
Solutions:
The challenge would be to keep BC, so if we indeed switch to Monolog we would need to implement our own message formatters to support
sprintf
and also implement our own adapters for the DB logging probably.I'm not saying we should do it today, but at least the discussion can be opened.
Linked discussions, for reference: #110, #6209, #6612
The text was updated successfully, but these errors were encountered: