From 3f45aff4a60003ea3fd97704d8c8c62633869c3d Mon Sep 17 00:00:00 2001 From: Web Addicto Date: Wed, 1 Feb 2017 18:09:51 +0100 Subject: [PATCH] Support $config['custom_logs_folder'] Allow to use a custom logs folder, useful if logs are saved in a directory on a network attached storage. --- src/LogPlugin.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/LogPlugin.php b/src/LogPlugin.php index e98249a..fa96fd9 100644 --- a/src/LogPlugin.php +++ b/src/LogPlugin.php @@ -2,13 +2,15 @@ use Proxy\Plugin\AbstractPlugin; use Proxy\Event\ProxyEvent; +use Proxy\Config; class LogPlugin extends AbstractPlugin { public function onHeadersReceived(ProxyEvent $event){ - // because this will be included in index.php - php-proxy-app/storage - $storage_dir = realpath('./storage'); + // to use a custom logs folder set it on main config.php with $config['custom_logs_folder'] = '/var/logs'; + // else it will use default /storage/ folder, because this will be included in index.php -> php-proxy-app/storage + $storage_dir = Config::get('custom_logs_folder') ? Config::get('custom_logs_folder') : realpath('./storage'); if(!is_writable($storage_dir)){ return; @@ -35,4 +37,4 @@ public function onHeadersReceived(ProxyEvent $event){ } -?> \ No newline at end of file +?>