Migrate logging docs to new interface

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst
2020-10-05 13:31:58 +02:00
parent a3bc1ade58
commit 5111715c34

View File

@@ -4,7 +4,7 @@ Logging
.. sectionauthor:: Bernhard Posselt <dev@bernhard-posselt.com>
The logger is present by default in the container. The app that is Logging is
The logger is present by default in the container. The app that is logging is
set automatically.
The logger can be used in the following way:
@@ -14,21 +14,20 @@ The logger can be used in the following way:
<?php
namespace OCA\MyApp\Service;
use \OCP\ILogger;
use Psr\Log\LoggerInterface;
class AuthorService {
private $logger;
private $appName;
public function __construct(ILogger $logger, string $appName){
public function __construct(LoggerInterface $logger, string $appName){
$this->logger = $logger;
$this->appName = $appName;
}
public function log($message) {
$this->logger->error($message, array('extra_context' => 'my extra context'));
$this->logger->error($message, ['extra_context' => 'my extra context']);
}
}