日志格式调整
This commit is contained in:
parent
2fe16ea344
commit
c61443cb69
|
@ -4,6 +4,7 @@ namespace JsonRpc\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use JsonRpc\Client;
|
use JsonRpc\Client;
|
||||||
|
use Monolog\Formatter\LineFormatter;
|
||||||
use Monolog\Handler\StreamHandler;
|
use Monolog\Handler\StreamHandler;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
|
|
||||||
|
@ -19,8 +20,13 @@ class ClientServiceProvider extends ServiceProvider
|
||||||
$this->app->configure('rpc');
|
$this->app->configure('rpc');
|
||||||
|
|
||||||
$config = config('rpc.client');
|
$config = config('rpc.client');
|
||||||
$logger = new Logger('rpc-client-logger');
|
$dateFormat = "Y n j, g:i a";
|
||||||
$logger->pushHandler(new StreamHandler($this->app->storagePath()."/logs/rpc_monitor_".date("Ymd").".log"));
|
$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) {
|
$this->app->singleton('rpc', function () use ($config, $logger) {
|
||||||
return new Client($config, $logger);
|
return new Client($config, $logger);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user