Jon Surrell
fbd91fe376
Improve email handler subject
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
af7b8646c5
Remove unneeded setUp and tearDown
...
WC_Logger tests no longer depend on writing/reading from log files.
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
065277a596
Fix WC_Logger::add test to match new 'notice' level.
2016-12-29 11:58:43 +01:00
Jon Surrell
50eb303a73
Fix WC_Log_Levels::is_valid_level tests
...
The wrong method was being called in tests.
2016-12-29 11:58:43 +01:00
Jon Surrell
23a45125e7
Add unit tests for wc_print_r()
...
Clean up some log logic ( `assertEquals( true ... )` becomse `assertTrue( ... )` ).
2016-12-29 11:58:43 +01:00
Jon Surrell
3f4b473a48
Improve PHP 5.2 test compatibility (older PHPUnit version)
2016-12-29 11:58:43 +01:00
Jon Surrell
b94d029546
Improve test compatibility (PHP 5.2)
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
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
Jon Surrell
5af479f61b
Add email log handler tests
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
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
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
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
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
05146089cd
Add DB handler tests
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
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
ad03597a3d
Simplify default log entry format
...
Remove punctuation. Space separate values:
TIMESTAMP LEVEL MESSAGE
2016-12-29 11:58:42 +01:00
Jon Surrell
e722870aa4
Fix tests for PHP 5.2
2016-12-29 11:58:42 +01:00
Jon Surrell
8600ccc6de
Restructure log tests to own directory
...
Also moves parent::tearDown to end of tearDown
Fix phpcs problems.
2016-12-29 11:58:42 +01:00
Jon Surrell
fe02d44e31
Defauly log file level is DEBUG
2016-12-29 11:58:42 +01:00
Jon Surrell
7ba54d8617
Add test for log() === [level_short_method]()
2016-12-29 11:58:42 +01:00
Jon Surrell
227651df77
Add `setMethods` to test mocks
...
This may improve php 5.2 test failures
2016-12-29 11:58:42 +01:00
Jon Surrell
83aad2ba2e
Use older test mock syntax for legacy compatibility.
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
fda6ab57bc
Fix tests for compatibility with PHP5
2016-12-29 11:58:42 +01:00
Jon Surrell
55963b09a8
Extract anonymous functions to improve test compatibility.
2016-12-29 11:58:42 +01:00
Jon Surrell
3ef2ae611d
Cleanup "A" test log file
2016-12-29 11:58:42 +01:00
Jon Surrell
c418623fed
Add tag context test for file log handler
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
7e79746302
Update tests for WC_Logger
2016-12-29 11:58:42 +01:00