改名
This commit is contained in:
@@ -8,6 +8,7 @@ use Kiri\Events\EventProvider;
|
|||||||
use Kiri\Exception\ConfigException;
|
use Kiri\Exception\ConfigException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Server\Events\OnAfterRequest;
|
use Server\Events\OnAfterRequest;
|
||||||
|
use Server\Events\OnWorkerStop;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +45,7 @@ class Logger implements LoggerInterface
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->eventProvider->on(OnAfterRequest::class, [$this, 'onAfterRequest']);
|
$this->eventProvider->on(OnAfterRequest::class, [$this, 'onAfterRequest']);
|
||||||
|
$this->eventProvider->on(OnWorkerStop::class, [$this, 'onAfterRequest']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -178,11 +180,12 @@ class Logger implements LoggerInterface
|
|||||||
{
|
{
|
||||||
$loggers = implode(PHP_EOL, $this->_loggers);
|
$loggers = implode(PHP_EOL, $this->_loggers);
|
||||||
$this->_loggers = [];
|
$this->_loggers = [];
|
||||||
|
if (!empty($loggers)) {
|
||||||
$filename = storage('log-' . date('Y-m-d') . '.log', 'logs/');
|
$filename = storage('log-' . date('Y-m-d') . '.log', 'logs/');
|
||||||
|
|
||||||
file_put_contents($filename, $loggers);
|
file_put_contents($filename, $loggers);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ class OnServerWorker extends \Server\Abstracts\Server
|
|||||||
putenv('state=exit');
|
putenv('state=exit');
|
||||||
|
|
||||||
$this->eventDispatch->dispatch(new OnWorkerExit($server, $workerId));
|
$this->eventDispatch->dispatch(new OnWorkerExit($server, $workerId));
|
||||||
$this->eventDispatch->dispatch(new OnAfterRequest());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user