Commit Graph

23 Commits

Author SHA1 Message Date
Gerhard Potgieter b3c998b0cd PHPCS passing for abstract-wc-long-handler 2018-03-05 13:36:56 +02:00
Jon Surrell 8e0f40d3d1 Add WC_Log_Handler_Interface
Abstract class `WC_Log_Handler` implements interface
2017-01-24 14:10:05 +01:00
Jon Surrell 2ae1bc1ab2 Protect methods 2016-12-29 11:58:43 +01:00
Jon Surrell acc98a1d6a Mark WC_Log_Handler::format_entry abstract 2016-12-29 11:58:43 +01:00
Jonathan Surrell 4318b3aa53 Improve @return signature on WC_Log_Handler::handle
Make meaning of returned bool explicit.
Update WC_Log_Handler_Email::handle accordingly.

via https://github.com/woocommerce/woocommerce/pull/12575#pullrequestreview-12381573
2016-12-29 11:58:43 +01:00
Jon Surrell ffd0d380ee Remove threshold logic from handlers.
Email handler implements threshold logic internally. Other handlers handle all logs received.
Handler constructors have changed.
2016-12-29 11:58:43 +01:00
Jon Surrell 85fa9df7fe Drop "bubbling" support for logs
The concept of bubbling or consuming logs has little benefit for our use case.
Drop support for bubbling and simplify logging.
2016-12-29 11:58:43 +01:00
Jon Surrell 4f77954bc7 Move log levels to independent class 2016-12-29 11:58:43 +01:00
Jon Surrell d88ea4ecea Spelling and doc fixes 2016-12-29 11:58:43 +01:00
Jon Surrell 5e9d4189fb Include missing 5 in log level severities 2016-12-29 11:58:42 +01:00
Jon Surrell a0670cfae8 Add woocommerce_format_log_entry filter to base WC_Log_Handler class 2016-12-29 11:58:42 +01:00
Jon Surrell 2283956db6 Provide correct class name to woocommerce_log_handler_set_threshold filter 2016-12-29 11:58:42 +01:00
Jon Surrell 0c5634c99f Version 1.0.0 for abstract wc log handler 2016-12-29 11:58:42 +01:00
Jon Surrell 822981c009 Improve handle signature
The signature of WC_Log_Handler::handle mirrors log messages which is more intuitive.
Method docblocks have also been improved and are more complete.
2016-12-29 11:58:42 +01:00
Jon Surrell ad03597a3d Simplify default log entry format
Remove punctuation. Space separate values:

TIMESTAMP LEVEL MESSAGE
2016-12-29 11:58:42 +01:00
Jon Surrell 722b288b79 Remove _ from private/protected properties 2016-12-29 11:58:42 +01:00
Jon Surrell 6ec75d8c2e Change defualt log handler threshold to DEBUG following discussion with team members. 2016-12-29 11:58:42 +01:00
Jon Surrell b5cebcab6c Fix scrutinizer issues 2016-12-29 11:58:42 +01:00
Jon Surrell d5d1ab16ea Fix docblocks 2016-12-29 11:58:42 +01:00
Jon Surrell 4262a72af6 Use wp_parse_args for default args 2016-12-29 11:58:42 +01:00
Jon Surrell 44ea69c579 Adds tests for bubbling, etc.
Add tests teardown to cleanup log files
Fix errors in log handlers
2016-12-29 11:58:42 +01:00
Jon Surrell 0e0433195d Add logic for log level filtering to `WC_Log_Handler`. 2016-12-29 11:58:42 +01:00
Jon Surrell 9a0efcfe55 Add abstract WC_Log_Handler class
Abstract base class is implemented with default formatting implementations.
`$timestamp` has been added to the `WC_Log_Handler::handle` implementation. This ensures all handlers are passed the same timestamp for the same message.
`_legacy` context has been added to `WC_Log_Handler_File` to ensure handle deprecated `WC_Logger::add` provides the same log entries as before.

Fix CS problems.
2016-12-29 11:58:42 +01:00