jinowom/yii2-pay-supports

v2.0 2022-08-03 10:29 UTC

This package is auto-updated.

Last update: 2024-09-30 01:32:33 UTC


README

使用数组/config/log/guzzle等进行处理

关于日志

use jinowom\Supports\Logger as Log;
use Monolog\Logger;

class ApplicationLogger
{
    private static $logger;

    /**
     * Forward call.
     *
     * @author jinowom <chareler@163.com>
     *
     * @return mixed
     */
    public static function __callStatic(string $method, array $args)
    {
        return call_user_func_array([self::getLogger(), $method], $args);
    }

    /**
     * Forward call.
     *
     * @author jinowom <chareler@163.com>
     *
     * @return mixed
     */
    public function __call(string $method, array $args)
    {
        return call_user_func_array([self::getLogger(), $method], $args);
    }

    /**
     * Make a default log instance.
     *
     * @author jinowom <chareler@163.com>
     *
     * @return Log
     */
    public static function getLogger()
    {
        if (! self::$logger instanceof Logger) {
            self::$logger = new Log();
        }   

        return self::$logger;
    }
}

用法

在注册Log之后,你可以使用Log服务

ApplicationLogger::debug('test', ['test log']);