aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Log/LogFactory.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-11 16:03:11 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-11 16:16:34 +0100
commitd45692ee9651f5dc32bee15d518a9c0cf5c5c2b9 (patch)
treeb63930e5895f407813befe0a992d23a8e83c51f5 /lib/private/Log/LogFactory.php
parent5babad4f6fb983709e7851bb5cea4bc0d2c7fe4c (diff)
downloadnextcloud-server-d45692ee9651f5dc32bee15d518a9c0cf5c5c2b9.tar.gz
nextcloud-server-d45692ee9651f5dc32bee15d518a9c0cf5c5c2b9.zip
Migrate custom loggers to PSR
This will help phase out the deprecated ILogger interface. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Log/LogFactory.php')
-rw-r--r--lib/private/Log/LogFactory.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/private/Log/LogFactory.php b/lib/private/Log/LogFactory.php
index 7064fe324e6..6e6ded3758b 100644
--- a/lib/private/Log/LogFactory.php
+++ b/lib/private/Log/LogFactory.php
@@ -31,6 +31,7 @@ use OCP\ILogger;
use OCP\IServerContainer;
use OCP\Log\ILogFactory;
use OCP\Log\IWriter;
+use Psr\Log\LoggerInterface;
class LogFactory implements ILogFactory {
/** @var IServerContainer */
@@ -70,6 +71,13 @@ class LogFactory implements ILogFactory {
return new Log($log, $this->systemConfig);
}
+ public function getCustomPsrLogger(string $path): LoggerInterface {
+ $log = $this->buildLogFile($path);
+ return new PsrLoggerAdapter(
+ new Log($log, $this->systemConfig)
+ );
+ }
+
protected function buildLogFile(string $logFile = ''):File {
$defaultLogFile = $this->systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log';
if ($logFile === '') {