From c61443cb698b861630feb369c57842bfd0d943c1 Mon Sep 17 00:00:00 2001 From: dongwei <838456736@qq.com> Date: Thu, 10 Jan 2019 15:05:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Providers/ClientServiceProvider.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Providers/ClientServiceProvider.php b/src/Providers/ClientServiceProvider.php index 1a03646..3354328 100644 --- a/src/Providers/ClientServiceProvider.php +++ b/src/Providers/ClientServiceProvider.php @@ -4,6 +4,7 @@ namespace JsonRpc\Providers; use Illuminate\Support\ServiceProvider; use JsonRpc\Client; +use Monolog\Formatter\LineFormatter; use Monolog\Handler\StreamHandler; use Monolog\Logger; @@ -19,8 +20,13 @@ class ClientServiceProvider extends ServiceProvider $this->app->configure('rpc'); $config = config('rpc.client'); - $logger = new Logger('rpc-client-logger'); - $logger->pushHandler(new StreamHandler($this->app->storagePath()."/logs/rpc_monitor_".date("Ymd").".log")); + $dateFormat = "Y n j, g:i a"; + $output = "%datetime% > %level_name% > %message% %context% %extra%\n"; + $formatter = new LineFormatter($output, $dateFormat); + $stream = new StreamHandler($this->app->storagePath()."/logs/rpc_monitor_".date("Ymd").".log"); + $stream->setFormatter($formatter); + $logger = new Logger('RPC.LOGGER'); + $logger->pushHandler($stream); $this->app->singleton('rpc', function () use ($config, $logger) { return new Client($config, $logger); });