diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-05-02 16:16:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-02 16:16:28 +0200 |
commit | 2aa108000cd5bb29b7be5d7226185b5c1be59e29 (patch) | |
tree | 46d6e45c3e88bfa46bd868f6120896b2a52a2948 /settings | |
parent | a56ec1062af36c02666277f7f97f6a407a87d1e1 (diff) | |
parent | aff5fe68b31c3663be2a114666650d2f8723a22b (diff) | |
download | nextcloud-server-2aa108000cd5bb29b7be5d7226185b5c1be59e29.tar.gz nextcloud-server-2aa108000cd5bb29b7be5d7226185b5c1be59e29.zip |
Merge pull request #9293 from nextcloud/feature/9166/custom-auditlogfile
option for a seperate audit log file
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/LogSettingsController.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/settings/Controller/LogSettingsController.php b/settings/Controller/LogSettingsController.php index 6405ff9ec73..ef195edce63 100644 --- a/settings/Controller/LogSettingsController.php +++ b/settings/Controller/LogSettingsController.php @@ -26,8 +26,11 @@ namespace OC\Settings\Controller; +use OC\Log; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\StreamResponse; +use OCP\ILogger; +use OCP\IRequest; /** * Class LogSettingsController @@ -35,6 +38,15 @@ use OCP\AppFramework\Http\StreamResponse; * @package OC\Settings\Controller */ class LogSettingsController extends Controller { + + /** @var ILogger */ + private $log; + + public function __construct(string $appName, IRequest $request, ILogger $logger) { + parent::__construct($appName, $request); + $this->log = $logger; + } + /** * download logfile * @@ -43,7 +55,10 @@ class LogSettingsController extends Controller { * @return StreamResponse */ public function download() { - $resp = new StreamResponse(\OC\Log\File::getLogFilePath()); + if(!$this->log instanceof Log) { + throw new \UnexpectedValueException('Log file not available'); + } + $resp = new StreamResponse($this->log->getLogPath()); $resp->addHeader('Content-Type', 'application/octet-stream'); $resp->addHeader('Content-Disposition', 'attachment; filename="nextcloud.log"'); return $resp; |