* This source file is subject to the license under the project that is bundled. */ use App\Model\User; use Hyperf\Utils\ApplicationContext; use Hyperf\Utils\Context; use Psr\Log\LoggerInterface; if (! function_exists('user')) { /** * 获取当前登录用户信息. */ function user(): ?User { return Context::get('user'); } } if (! function_exists('logger')) { /** * 获取日志. * @param string $name * @return LoggerInterface */ function logger($name = 'app'): LoggerInterface { return ApplicationContext::getContainer()->get(\Hyperf\Logger\LoggerFactory::class)->get($name); } }