Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

developer: Add information about ILogger #12219

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Changed APIs
^^^^^^^^^^^^

- Clarify ``OCP\Files\Storage\IStorage::getOwner()`` returns ``string|false``.
- The Nextcloud implementation of the ``log`` method of ``Psr\Log\LoggerInterface`` now supports ``Psr\Log\LogLevel`` as log level parameter.

Deprecated APIs
^^^^^^^^^^^^^^^
Expand All @@ -84,3 +85,10 @@ Removed APIs
^^^^^^^^^^^^

- Legacy, non functional, ``OC_App::getForms`` was removed.
- All ``OCP\ILogger`` logging methods, deprecated since Nextcloud 20, are removed.
- The interface now only holds the Nextcloud internal logging level constants.
For all logging ``Psr\Log\LoggerInterface`` should be used.
- The ``OCP\ILogger`` interface can no longer be dependency injected as it now only holds constants.
- ``OCP\IServerContainer::getLogger`` was removed, use dependency injection with ``Psr\Log\LoggerInterface`` instead.
- The internal class ``OC\AppFramework\Logger`` was removed, it should have been never used by apps.
All using apps should migrate to ``Psr\Log\LoggerInterface``.
2 changes: 1 addition & 1 deletion developer_manual/basics/dependency_injection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ Types:
* ``\OCP\Files\IRootFolder``
* ``\OCP\IGroupManager``
* ``\OCP\IL10N``
* ``\OCP\ILogger``
* ``\OCP\BackgroundJob\IJobList``
* ``\OCP\INavigationManager``
* ``\OCP\IPreview``
Expand All @@ -398,6 +397,7 @@ Types:
* ``\OCP\IUserManager``
* ``\OCP\IUserSession``
* ``\Psr\Container\ContainerInterface``
* ``\Psr\Log\LoggerInterface``

How to enable it
^^^^^^^^^^^^^^^^
Expand Down
7 changes: 6 additions & 1 deletion developer_manual/digging_deeper/psr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ PSR-3: Logger Interface

.. versionadded:: 19

The dependency injection container can inject an instance of a ``\Psr\Log\LoggerInterface``. This is merely a wrapper of the existing (and strongly typed) ``\OCP\ILogger``. Apps may still use the Nextcloud logger, but the `PSR-3`_ implementation shall easy the integration of 3rd party libraries that require the `PSR-3`_ logger.
The dependency injection container can inject an instance of a ``\Psr\Log\LoggerInterface``.
The `PSR-3`_ implementation shall easy the integration of 3rd party libraries that require the `PSR-3`_ logger.

.. versionchanged:: 21
Nextcloud ships version 1.1.3
.. versionchanged:: 23
Nextcloud ships version 1.1.4
.. versionchanged:: 30
Nextcloud ships version 2.0.0
.. versionchanged:: 31
The ``\Psr\Log\LoggerInterface`` fully replaced the Nextcloud internal logging methods.

.. _psr4:

Expand Down