mirror of
https://github.com/nextcloud/documentation.git
synced 2026-01-04 10:46:21 +07:00
Document logger function in dev manual
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
@@ -5,7 +5,7 @@ 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.
|
||||
set automatically. Nextcloud uses a :ref:`PSR3 <psr3>` logger.
|
||||
|
||||
The logger can be used in the following way:
|
||||
|
||||
@@ -30,14 +30,14 @@ The logger can be used in the following way:
|
||||
}
|
||||
}
|
||||
|
||||
In cases where you can not :ref:`inject <dependency-injection>` a logger into a class, you can use
|
||||
the ``\OCP\Log\logger`` function to acquire a logger instance. As a first argument you need to pass
|
||||
the app ID.
|
||||
|
||||
The following methods are available:
|
||||
.. code-block:: php
|
||||
|
||||
* **emergency**
|
||||
* **alert**
|
||||
* **critical**
|
||||
* **error**
|
||||
* **warning**
|
||||
* **notice**
|
||||
* **info**
|
||||
* **debug**
|
||||
<?php
|
||||
|
||||
use function OCP\Log\logger;
|
||||
|
||||
logger('calendar')->warning('look, no dependency injection');
|
||||
|
||||
Reference in New Issue
Block a user