You've already forked php-auth
generated from siteworxpro/Php-Template
Initial commit
This commit is contained in:
39
src/Services/Facades/RoadRunnerLogger.php
Normal file
39
src/Services/Facades/RoadRunnerLogger.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Siteworxpro\App\Services\Facades;
|
||||
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use RoadRunner\Logger\Logger;
|
||||
use Siteworxpro\App\Services\Facade;
|
||||
use Spiral\Goridge\RPC\RPC;
|
||||
|
||||
class RoadRunnerLogger extends Facade
|
||||
{
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public static function getFacadeRoot(): mixed
|
||||
{
|
||||
$container = static::getFacadeContainer();
|
||||
if ($container && $container->has(Logger::class) === false) {
|
||||
$rpc = RPC::create($_SERVER['RR_RPC']);
|
||||
$logger = new Logger($rpc);
|
||||
$container->bind(static::getFacadeAccessor(), function () use ($logger) {
|
||||
return $logger;
|
||||
});
|
||||
|
||||
return $logger;
|
||||
}
|
||||
|
||||
return $container->get(Logger::class);
|
||||
}
|
||||
|
||||
protected static function getFacadeAccessor(): string
|
||||
{
|
||||
return Logger::class;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user