Jon Surrell
03889f77cc
Update use of deprecated wc_get_log_file_path
2016-12-29 11:58:43 +01:00
Jon Surrell
088fc5cd68
Delay file log write when written too early
...
The function to look up log file paths depends on `wp_hash`, which is pluggable.
Log files cannot be found before `plugins_loaded` action. In case a log is
written to a file before `wp_hash` is available, cache and write on
`plugins_loaded` action.
2016-12-29 11:58:43 +01:00
Jon Surrell
5700043e6d
Deprecate wc_get_log_file_path
...
wc_get_log_file_path moves into `WC_Log_Handler_File` class as a static
method.
Update deprecations and version info.
2016-12-29 11:58:43 +01:00
Jon Surrell
feefabbdf0
Document _legacy context in WC_Log_Handler_File
2016-12-29 11:58:43 +01:00
Jon Surrell
665e8ccfc6
Improve doc comments and access.
2016-12-29 11:58:43 +01:00
Jon Surrell
f908a0181c
Improve deprecation messages for WC_Logger
...
clear and remove *do* have alternatives. They have essentially
been moved to the file handler.
2016-12-29 11:58:43 +01:00
Jon Surrell
6068f681d3
Use 'notice' as level for deprecated WC_Logger::add messages.
...
Notice is the default (and recommended) threshold for production sites. Using
info, which is below notice, would result in ::add messages to be filtered by
default. This would be a confusing experience for users calling the deprecated
function and expecting a log.
2016-12-29 11:58:43 +01:00
Jon Surrell
de076a313e
Fix settings log texts
...
Add 'woocommerce' to __ translated texts.
Improve texts.
2016-12-29 11:58:43 +01:00
Jon Surrell
d4e8bb82e6
Remove new handler arguments from `wc_register_default_log_handler`
2016-12-29 11:58:43 +01:00
Jon Surrell
970a33e182
Cleanup log list table view
...
Format log timestamp.
Add is_valid_level check to $_REQUEST level filter.
General cleanup: formatting, layout, commentary.
2016-12-29 11:58:43 +01:00
Jon Surrell
aee5917440
Change wc_safe_dump to wc_print_r
...
Match print_r arguments, this makes usage obvious.
2016-12-29 11:58:43 +01:00
Jon Surrell
2ae1bc1ab2
Protect methods
2016-12-29 11:58:43 +01:00
Jon Surrell
fe837c5113
Aggregate email handler messages (max: 1 email/request/handler)
...
Update emails accordingly.
Update email handler tests.
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
Jon Surrell
5f24eca7e2
Add delete to db log viewer table
...
Clean up some nonce logic.
Use a single <form> containing log table.
2016-12-29 11:58:43 +01:00
Jon Surrell
9ba616b2c1
Return single instance from wc_get_logger
...
Remove class include from wc_get_logger (should be autoloaded).
Add tests for wc_get_logger.
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
81eaa5ae17
Make lot threshold strings translatable
2016-12-29 11:58:43 +01:00
Jon Surrell
080cf8e436
Store log levels as integer representations in database
...
This will allow indexed ordering by severity.
Add WC_Log_Levels::get_severity_level method to translate severity
integers to level strings. The inverse of WC_Log_Levels::get_level_severity.
Add context to tests.
2016-12-29 11:58:43 +01:00
Jon Surrell
78e6cb31a7
Include WC_Log_Handler with other abstracts
2016-12-29 11:58:43 +01:00
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
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
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
44ec07902d
Add confirmation to db log flush
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
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