33 lines
703 B
PHP
33 lines
703 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/**
|
|
* This file is part of Hyperf.
|
|
*
|
|
* @link https://www.hyperf.io
|
|
* @document https://hyperf.wiki
|
|
* @contact group@hyperf.io
|
|
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
|
*/
|
|
namespace App\Utils;
|
|
|
|
use Hyperf\Logger\LoggerFactory;
|
|
use Hyperf\Utils\ApplicationContext;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
/**
|
|
* 重写log类
|
|
*/
|
|
class Log
|
|
{
|
|
public static function __callStatic($name, $arguments)
|
|
{
|
|
self::getInstance()->{$name}(...$arguments);
|
|
}
|
|
|
|
public static function getInstance(string $name = 'app'): LoggerInterface
|
|
{
|
|
return ApplicationContext::getContainer()->get(LoggerFactory::class)->get($name);
|
|
}
|
|
}
|