Commit Graph

18867 Commits

Author SHA1 Message Date
Jon Surrell 825d9c9f82 Fix spelling 2016-12-29 11:58:43 +01:00
Jon Surrell 88836b9cca Drop WP_DEBUG override threshold. Improve logger tests.
This may be unexpected behavior for a user, their level is overridden with no
way to change it. It also greatly complicates testing default thresholds.

Dependency on WC_Log_Handler_File has been removed from logger tests.
2016-12-29 11:58:43 +01:00
Jon Surrell 0bea7e1305 Improve logger tests 2016-12-29 11:58:43 +01:00
Jon Surrell 0389909d88 Improve logger tests 2016-12-29 11:58:43 +01:00
Jon Surrell 2626c5b3af Accept explicit handlers and threshold in WC_Logger 2016-12-29 11:58:43 +01:00
Jon Surrell be38e8f2fe Add log threshold setting to settings page 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 2945b4755f Add more information about log levels 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 ae72ce24c4 Drop `var_dump` as safe dump alternative
var_dump does not support returning string representation.
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 60314e5ba1 Fix spelling errors 2016-12-29 11:58:43 +01:00
Jon Surrell eca10f6362 Explicit use of file log handler for logger tests 2016-12-29 11:58:43 +01:00
Jon Surrell 0f13cca921 Use autoloader for log handlers 2016-12-29 11:58:43 +01:00
Jon Surrell e2f76bcd54 Fix logs-db redirects 2016-12-29 11:58:42 +01:00
Jon Surrell c633db9d65 Add woocommerce_default_log_handler setting
Adds configuration to settings page
Show status-logs page based on settings (unify logs & database logs)
Register default log handler by default
2016-12-29 11:58:42 +01:00
Jon Surrell 81223995fc Add basic email logger test 2016-12-29 11:58:42 +01:00
Jon Surrell ceea56e323 Add test for multiple file log handlers writing to same file. 2016-12-29 11:58:42 +01:00
Jon Surrell b6304cbcc4 Prefer "unit-tests" tag for testing log handler 2016-12-29 11:58:42 +01:00
Jon Surrell dd2474fb3c Rename test file log -> logger 2016-12-29 11:58:42 +01:00
Jon Surrell dce4e7c21a Fix misnamed test class 2016-12-29 11:58:42 +01:00
Jon Surrell e5b369b431 Remove bad logger test
Test comparing equality of logger results could randomly fail depending on execution time.
The coverage was duplicated by other tests, test was redundant and has been removed.
2016-12-29 11:58:42 +01:00
Jon Surrell 44ec07902d Add confirmation to db log flush 2016-12-29 11:58:42 +01:00
Jon Surrell 05146089cd Add DB handler tests 2016-12-29 11:58:42 +01:00
Jon Surrell 9d80017308 Mark db handler add method as static 2016-12-29 11:58:42 +01:00
Jon Surrell c945d727d5 Add log flushing to db log viewer 2016-12-29 11:58:42 +01:00
Jon Surrell 0f63e5bfdb Add severity level tests 2016-12-29 11:58:42 +01:00
Jon Surrell 5e9d4189fb Include missing 5 in log level severities 2016-12-29 11:58:42 +01:00
Jon Surrell e42d2e61fd Update print_r to use wc_safe_dump 2016-12-29 11:58:42 +01:00
Jon Surrell 691c35e97b Update logger calls 2016-12-29 11:58:42 +01:00
Jon Surrell 66b0620f7c remove print_r calls from paypal handler 2016-12-29 11:58:42 +01:00
Jon Surrell 96f9de2106 update paypal gateway logs 2016-12-29 11:58:42 +01:00
Jon Surrell 36201d38ec Update paypal gateway log method 2016-12-29 11:58:42 +01:00
Jon Surrell 7a3c6bcc0c Fix phpcs issues 2016-12-29 11:58:42 +01:00
Jon Surrell 915266f967 Add wc_safe_dump function
Some "safe" server configurations disable certain functions. `wc_safe_dump` attempts to
safely call a series of alternatives suitable for dumping an expression.
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 d6a6b8771d Add level views to db log table 2016-12-29 11:58:42 +01:00
Jon Surrell 30fdca65a9 Log viewer via html template 2016-12-29 11:58:42 +01:00
Jon Surrell bc3f788507 Implements database log viewer 2016-12-29 11:58:42 +01:00
Jon Surrell f761183363 Update @package for log handlers 2016-12-29 11:58:42 +01:00
Jon Surrell 5a9db9738f Add DB log handler 2016-12-29 11:58:42 +01:00
Jon Surrell 09ea8b074e Prefer PHP_EOL over "\n" 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 e7d6a9a48b Rotate logs
WC_Log_Handler_File now includes log rotation.
Add and improve tests.
2016-12-29 11:58:42 +01:00
Jon Surrell 7359cca4a9 Add specific file log handler tests 2016-12-29 11:58:42 +01:00
Jon Surrell 2a6c95b490 Prevent possible undefined index warning 2016-12-29 11:58:42 +01:00
Jon Surrell 75c3e5e8c6 Fix phpcs warning 2016-12-29 11:58:42 +01:00