Skip to content
Snippets Groups Projects
Select Git revision
  • 93f656838d39677e7beef8f89ac393f8d35b8761
  • main default protected
  • v0.10
  • 0.10.6
  • 0.10.5
  • 0.10.4
  • 0.10.3
  • 0.10.2
  • 0.10.1
  • 0.10.0
  • 0.9.1
  • 0.9.0
12 results

services.inc.php

Blame
  • WooCommerceMonologPlugin.php 4.01 KiB
    <?php
    
    namespace WPDesk\Logger\WC;
    
    use Monolog\Logger;
    use Psr\Log\LogLevel;
    use WC_Log_Levels;
    
    
    /**
     * Can decorate monolog with WC_Logger_Interface
     *
     * @package WPDesk\Logger
     */
    class WooCommerceMonologPlugin implements \WC_Logger_Interface
    {
    
        /** @var Logger */
        private $monolog;
    
        /** @var \WC_Logger */
        private $originalWCLogger;
    
        public function __construct(Logger $monolog, \WC_Logger_Interface $originalLogger)
        {
            $this->monolog = $monolog;
            $this->originalWCLogger = $originalLogger;
        }
    
        /**
         * Method added for compatibility with \WC_Logger
         *
         * @param string $source
         */
        public function clear($source = ''): void
        {
            $this->originalWCLogger->clear($source);
        }
    
        /**
         * Method added for compatibility with \WC_Logger
         */
        public function clear_expired_logs(): void
        {
            $this->originalWCLogger->clear_expired_logs();
        }
    
        /**
         * Method for compatibility reason. Do not use.
         *
         * @param string $handle
         * @param string $message
         * @param string $level
         * @return bool|void
         *
         * @deprecated
         */
        public function add($handle, $message, $level = WC_Log_Levels::NOTICE): void
        {
            $this->log($message, $level);
        }
    
        /**
         * System is unusable.
         *
         * @param string $message
         * @param array $context
         *
         * @return void
         */