Commit Graph

46 Commits

Author SHA1 Message Date
Jon Surrell c633b07f73 Fix style 2016-12-29 11:58:43 +01:00
Jon Surrell 4b13e3b053 Do not deprecate WC_Logger::add 2016-12-29 11:58:43 +01:00
Jon Surrell e4d5886427 Replace log `tag` with log `source` 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 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 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 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 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 722b288b79 Remove _ from private/protected properties 2016-12-29 11:58:42 +01:00
Jon Surrell b5cebcab6c Fix scrutinizer issues 2016-12-29 11:58:42 +01:00
Jon Surrell c5c0563f7c Restore deprecated functions WC_Logger::clear & WC_Logger::remove
Also updates clear test to supply required argument.
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
Jon Surrell d9dcabf8f2 WC_Logger registers and delegates logging to handlers 2016-12-29 11:58:42 +01:00
David Marín 22229d1e2e Fix space between parenthesis 2016-09-15 21:43:56 +02:00
David Marín 3ab087212b Update class-wc-logger.php 2016-09-15 11:04:35 +02:00
David Marín d74e4e27a7 Update class-wc-logger.php 2016-09-14 13:28:28 +02:00
Claudio Sanches e72af424ac Check if FS_CHMOD_FILE is defined #11901 2016-09-13 18:38:16 -03:00
Mike Jolley 4d041b2ce2 chmod file when closed. 2016-09-12 23:37:02 +01:00
Rasmus 9e8670015e Make WC_Logger follow FS_CHMOD_FILE when file is created
When WC_Logger creates a file it should use the permissions defined in FS_CHMOD_FILE

See https://codex.wordpress.org/Editing_wp-config.php#Override_of_default_file_permissions
2016-09-12 12:59:18 +02:00
Aristeides Stathopoulos f2730eea02 WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd 2016-08-27 08:57:05 +03:00
Mike Jolley 922ba0337f Fix removal and tweak buttons 2016-08-02 14:42:27 +01:00
toddlahman 26353d7099 added remove method to logger class, and delete GeoIP Log button to tools 2016-07-02 23:16:11 -07:00
Mike Jolley a60b03baa9 Log close method. Fixes unit tests. 2016-04-19 16:56:43 +01:00
Mike Jolley f47a1de108 Close file if it's already open before clear 2016-04-19 16:31:36 +01:00
Mike Jolley ab61975357 Tweak returns 2016-04-19 14:00:40 +01:00
toddlahman 6003fb3303 ftruncate failed at times, so fopen() in w mode used instead. 2016-04-15 21:26:19 -07:00
toddlahman 157c50df0a return boolean log add and clear method result 2016-04-12 23:46:30 -07:00
Fredrik Forsmo bb19615029 Improve docblock comments in various WC_* classes
* Added comments to various methods
* Fixed various properties comments and param types
2016-01-06 16:24:47 +01:00
Nicola Mustone c9da4f928a check if ABSPATH is defined 2015-11-06 10:22:19 +01:00
Claudio Sanches 5893875b0c Removed period for file headers 2015-11-03 11:53:50 -02:00
Claudio Sanches 9e41552342 Removed all "@return void" 2015-07-16 16:55:48 -03:00
Patrick Garman fb84486798 Update WC_Logger to include actions on add & clear methods
This allows for easy integrating with third party logging services.
2015-07-10 14:26:30 -05:00
Alexander Concha 7896b49684 fclose requires a resource, not a string. 2015-06-01 12:58:06 +01:00
Scrutinizer Auto-Fixer 19f660171e Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-01-23 14:37:20 +00:00
claudiosmweb 7ca27a8f80 introduces the wc_get_log_file_path() function 2014-05-28 11:08:33 -03:00
Mike Jolley 1ed0938581 [2.2] Log changes Closes #4926
Added WC_LOG_DIR constant
Added log viewer
Changed default logging directory to 1 up from ABSPATH inside wc-logs
2014-05-28 11:12:38 +01:00
Coen Jacobs 19688ad9ef Fixed several @return void clauses. There are more. No code changes in this commit, only PhpDocs
Closes #4216
2013-11-27 10:03:47 +01:00
Mike Jolley 51ba9c393f WC globals 2013-11-25 14:01:38 +00:00
Mike Jolley c75ea04c1c classes -> includes 2013-06-11 14:25:30 +01:00