Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Migrate logging docs to new interface
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Oct 5, 2020
commit 5111715c344f2bcd429db2629aba7bf1a741f47e
9 changes: 4 additions & 5 deletions developer_manual/basics/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Logging

.. sectionauthor:: Bernhard Posselt <[email protected]>

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:
Expand All @@ -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']);
}

}
Expand Down