Skip to content
Snippets Groups Projects
Commit 67c93eed authored by dyszczo's avatar dyszczo
Browse files

WC integration now considers broken WC_Logger implementation

parent 47744abb
Branches
Tags
1 merge request!8Feature/broken wc logger
## [1.4.0] - 2019-01-21
### Changed
- WC integration now considers broken WC_Logger implementation
## [1.3.1] - 2018-10-30
### Changed
- setDisableLog changes to disableLog
......
......@@ -65,7 +65,7 @@ class WooCommerceCapture
if ($this->captureHookFunction === null) {
$this->captureHookFunction = function () use ($monolog) {
return new WooCommerceMonologPlugin($monolog);
return new WooCommerceMonologPlugin($monolog, $this->originalWCLogger);
};
$this->monolog->pushHandler(new WooCommerceHandler($this->originalWCLogger));
}
......
......@@ -12,13 +12,37 @@ use WC_Log_Levels;
*
* @package WPDesk\Logger
*/
class WooCommerceMonologPlugin implements \WC_Logger_Interface {
class WooCommerceMonologPlugin implements \WC_Logger_Interface
{
/** @var Logger */
private $monolog;
public function __construct( Logger $monolog ) {
/** @var \WC_Logger */
private $originalWCLogger;
public function __construct(Logger $monolog, \WC_Logger $originalLogger)
{
$this->monolog = $monolog;
$this->originalWCLogger = $originalLogger;
}
/**
* Method added for compatibility with \WC_Logger
*
* @param string $source
*/
public function clear($source = '')
{
$this->originalWCLogger->clear($source);
}
/**
* Method added for compatibility with \WC_Logger
*/
public function clear_expired_logs()
{
$this->originalWCLogger->clear_expired_logs();
}
/**
......@@ -31,7 +55,8 @@ class WooCommerceMonologPlugin implements \WC_Logger_Interface {
*
* @deprecated
*/
public function add( $handle, $message, $level = WC_Log_Levels::NOTICE ) {
public function add($handle, $message, $level = WC_Log_Levels::NOTICE)
{
$this->log($message, $level);
}
......@@ -48,7 +73,8 @@ class WooCommerceMonologPlugin implements \WC_Logger_Interface {
$this->log(LogLevel::EMERGENCY, $message, $context);
}
public function log( $level, $message, $context = [] ) {
public function log($level, $message, $context = [])
{
$this->monolog->log($level, $message, $context);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment