From b0d88bc2bf3d6e3cf6803003becd4f641eb8f4ed Mon Sep 17 00:00:00 2001 From: dongwei <838456736@qq.com> Date: Fri, 11 Jan 2019 15:27:18 +0800 Subject: [PATCH] client log config --- src/Client.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Client.php b/src/Client.php index e197652..1626643 100644 --- a/src/Client.php +++ b/src/Client.php @@ -24,12 +24,14 @@ class Client { $default = [ 'app' => '***', + 'log_path'=> "/logs/rpc_monitor_".date("Ymd").".log", + 'log_formatter' => 'LogstashFormatter', ]; - $stream = new StreamHandler(app()->storagePath()."/logs/rpc_monitor_".date("Ymd").".log"); - $stream->setFormatter(new LogstashFormatter()); + $this->config = array_merge($default, $config); + $stream = new StreamHandler(app()->storagePath().$this->config['log_path']); + $stream->setFormatter(new $this->config['log_formatter']()); $logger = new Logger('RPC.LOGGER'); $logger->pushHandler($stream); - $this->config = array_merge($default, $config); $this->id = 0; $this->logger = $logger; }