mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-02 17:59:36 +07:00
This moves lots of pages around. The high-level changes are * Better main sections, so it's more *general*, *into*, *basics* and *details* * Move more general topics to a *Basic* section, which are not app-specific * Remove app docs to the stuff that is likely used, anything else goes into "Digging deeper" * Move general guides into a prologue * Try to *compress*/combine some pages with similar content * Try to have better consistencs on level ob abstraction across pages * Split app development and maintenance pages into two sections * Integrate bugtracker info into prologue * Integrate Android pages into client APIs section Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
47 lines
851 B
ReStructuredText
47 lines
851 B
ReStructuredText
=======
|
|
Logging
|
|
=======
|
|
|
|
.. sectionauthor:: Bernhard Posselt <dev@bernhard-posselt.com>
|
|
|
|
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:
|
|
|
|
.. code-block:: php
|
|
|
|
<?php
|
|
namespace OCA\MyApp\Service;
|
|
|
|
use \OCP\ILogger;
|
|
|
|
|
|
class AuthorService {
|
|
|
|
private $logger;
|
|
private $appName;
|
|
|
|
public function __construct(ILogger $logger, string $appName){
|
|
$this->logger = $logger;
|
|
$this->appName = $appName;
|
|
}
|
|
|
|
public function log($message) {
|
|
$this->logger->error($message, array('extra_context' => 'my extra context'));
|
|
}
|
|
|
|
}
|
|
|
|
|
|
The following methods are available:
|
|
|
|
* **emergency**
|
|
* **alert**
|
|
* **critical**
|
|
* **error**
|
|
* **warning**
|
|
* **notice**
|
|
* **info**
|
|
* **debug**
|