diff options
-rw-r--r-- | lib/private/Log.php | 2 | ||||
-rw-r--r-- | tests/lib/LoggerTest.php | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php index af0ca140cb9..5ba19698612 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -339,7 +339,7 @@ class Log implements ILogger { $logClass = 'OC\\Log\\' . ucfirst($logType); if (!class_exists($logClass)) { - $logClass = 'OC\\Log\\File'; + $logClass = \OC\Log\File::class; } return $logClass; diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index abb9deebd55..8bae8d18228 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -138,4 +138,20 @@ class LoggerTest extends TestCase { } } + public function dataGetLogClass() { + return [ + ['owncloud', \OC\Log\File::class], + ['nextcloud', \OC\Log\File::class], + ['file', \OC\Log\File::class], + ['errorlog', \OC\Log\Errorlog::class], + ['syslog', \OC\Log\Syslog::class], + ]; + } + + /** + * @dataProvider dataGetLogClass + */ + public function testGetLogClass($type, $class) { + $this->assertEquals($class, Log::getLogClass($type)); + } } |