PFinal\Wechat\Support\Logger::init PHP Method

init() public method

public init ( )
    public function init()
    {
        if ($this->logger instanceof \Psr\Log\LoggerInterface) {
            return;
        }
        $logger = new \Monolog\Logger($this->name);
        if (defined('PHPUNIT_RUNNING')) {
            $logger->pushHandler(new NullHandler());
        } else {
            if (empty($this->file)) {
                $logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $this->level));
            } else {
                $logger->pushHandler(new StreamHandler($this->file, $this->level));
            }
        }
        $this->logger = $logger;
    }