From 7fa063ceca5d78741c47f645c6dfdf65e4be7330 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 10 Jan 2017 12:58:23 +0100 Subject: Better fallback for unknown log types Signed-off-by: Joas Schilling --- lib/private/Log.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'lib/private/Log.php') diff --git a/lib/private/Log.php b/lib/private/Log.php index 5ba19698612..fddd3593127 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -330,18 +330,19 @@ class Log implements ILogger { * @internal */ public static function getLogClass($logType) { - // TODO: Drop backwards compatibility for config in the future switch (strtolower($logType)) { + case 'errorlog': + return \OC\Log\Errorlog::class; + case 'syslog': + return \OC\Log\Syslog::class; + case 'file': + return \OC\Log\File::class; + + // Backwards compatibility for old and fallback for unknown log types case 'owncloud': case 'nextcloud': - $logType = 'file'; + default: + return \OC\Log\File::class; } - $logClass = 'OC\\Log\\' . ucfirst($logType); - - if (!class_exists($logClass)) { - $logClass = \OC\Log\File::class; - } - - return $logClass; } } -- cgit v1.2.3