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

Rewrite logging in Piwik and remove Zend_Log #110

Merged
merged 26 commits into from Sep 28, 2013
Merged

Rewrite logging in Piwik and remove Zend_Log #110

merged 26 commits into from Sep 28, 2013

Conversation

diosmosis
Copy link
Member

Big ideas in this pull request:

  • Replaces all Piwik logging classes into one.
  • Merges logging channels into one (ie, different files or different database tables).
  • Maintains behavior of Piwik where errors/exception are always logged to the screen and errors/exceptions are outputted differently to the screen than to other backends.
  • Introduces logging level concept and logging tag concept (see Android logging API).

@robocoder
Copy link
Contributor

Any thoughts on implementing the Psr\LoggerInterface?

… class name when plugin can't be determined.
@halfdan
Copy link
Member

halfdan commented Sep 27, 2013

Would be great if we'd implement: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md

How is logging to the database handled now? We currently have four database tables for logging: _logger_message, _logger_exception, _logger_api_call, _logger_error - could we simply merge these tables into a single one with a type field? This layout is mainly influenced by the way ZF1 handled logging.

@diosmosis
Copy link
Member Author

Re Psr\LoggerInterface:

Is there any tangible benefit that implementing LoggerInterface would provide Piwik core developers and Piwik plugin developers?

@halfdan

We currently have four database tables for logging: _logger_message, _logger_exception, _logger_api_call, _logger_error - could we simply merge these tables into a single one with a type field?

This is part of what my pull request does.

@robocoder
Copy link
Contributor

Using PSR3, theoretically, would make it easier for enterprises to swap out our logger for something else. For example, monolog has handlers for AMQP and NewRelic.

@diosmosis
Copy link
Member Author

So it would be easier for Piwik users to use logger backends that Piwik doesn't provide? I think that's something for @mattab to think about.

@mattab
Copy link
Member

mattab commented Sep 27, 2013

sounds interesting, but it's not MVP for the Log rewrite

@halfdan
Copy link
Member

halfdan commented Sep 28, 2013

@diosmosis Very cool!

Would it be difficult to implement PSR3? The closer we get to the PSR standards the better IMHO.

@diosmosis
Copy link
Member Author

Would it be difficult to implement PSR3? The closer we get to the PSR standards the better IMHO.

Do you have any reasons for that? Using the PSR implementation would mean more code for the logger, more code for users of the logger, and more code for anything that should be "capable" of logging. We could easily add an event to allow plugins to provide new writers and a plugin could provide the PSR3 adapter itself.

mattab pushed a commit that referenced this pull request Sep 28, 2013
Rewrite logging in Piwik and remove Zend_Log
goal: logging easily reusable by plugin developers. The next step will be to allow developers to easily view the logs, Log Viewer UI is in http://dev.piwik.org/trac/ticket/2473 (would be useful to view eg. archive.php frequency&exec times)
@mattab mattab merged commit 9e9b3cb into master Sep 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.

None yet

4 participants