2014-05-06 19:55:06 -04:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-02-26 16:34:13 -05:00
|
|
|
declare(strict_types=1);
|
2014-05-06 19:55:06 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCP;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interface ILogger
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-05-06 19:55:06 -04:00
|
|
|
*
|
|
|
|
|
* This logger interface follows the design guidelines of PSR-3
|
|
|
|
|
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use the PSR-3 logger \Psr\Log\LoggerInterface
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
|
|
|
|
interface ILogger {
|
2018-04-25 09:22:28 -04:00
|
|
|
/**
|
|
|
|
|
* @since 14.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0
|
2018-04-25 09:22:28 -04:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const DEBUG = 0;
|
2018-04-25 09:22:28 -04:00
|
|
|
/**
|
|
|
|
|
* @since 14.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0
|
2018-04-25 09:22:28 -04:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const INFO = 1;
|
2018-04-25 09:22:28 -04:00
|
|
|
/**
|
|
|
|
|
* @since 14.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0
|
2018-04-25 09:22:28 -04:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const WARN = 2;
|
2018-04-25 09:22:28 -04:00
|
|
|
/**
|
|
|
|
|
* @since 14.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0
|
2018-04-25 09:22:28 -04:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const ERROR = 3;
|
2018-04-25 09:22:28 -04:00
|
|
|
/**
|
|
|
|
|
* @since 14.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0
|
2018-04-25 09:22:28 -04:00
|
|
|
*/
|
2020-10-05 09:12:57 -04:00
|
|
|
public const FATAL = 4;
|
2018-04-25 09:22:28 -04:00
|
|
|
|
2014-05-06 19:55:06 -04:00
|
|
|
/**
|
|
|
|
|
* System is unusable.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::emergency
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function emergency(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Action must be taken immediately.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::alert
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function alert(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Critical conditions.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::critical
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function critical(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Runtime errors that do not require immediate action but should typically
|
|
|
|
|
* be logged and monitored.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::error
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function error(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Exceptional occurrences that are not errors.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::warning
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function warning(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Normal but significant events.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::notice
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function notice(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interesting events.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::info
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function info(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Detailed debug information.
|
|
|
|
|
*
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::debug
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-26 16:34:13 -05:00
|
|
|
public function debug(string $message, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Logs with an arbitrary level.
|
|
|
|
|
*
|
2018-02-27 04:45:35 -05:00
|
|
|
* @param int $level
|
2014-05-06 19:55:06 -04:00
|
|
|
* @param string $message
|
|
|
|
|
* @param array $context
|
|
|
|
|
* @return mixed
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use \Psr\Log\LoggerInterface::log
|
2014-05-06 19:55:06 -04:00
|
|
|
*/
|
2018-02-27 04:45:35 -05:00
|
|
|
public function log(int $level, string $message, array $context = []);
|
2015-09-24 11:01:31 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Logs an exception very detailed
|
2016-01-15 07:13:27 -05:00
|
|
|
* An additional message can we written to the log by adding it to the
|
|
|
|
|
* context.
|
|
|
|
|
*
|
|
|
|
|
* <code>
|
|
|
|
|
* $logger->logException($ex, [
|
2017-05-16 15:12:28 -04:00
|
|
|
* 'message' => 'Exception during background job execution'
|
2016-01-15 07:13:27 -05:00
|
|
|
* ]);
|
|
|
|
|
* </code>
|
2015-09-24 11:01:31 -04:00
|
|
|
*
|
2017-07-19 09:48:58 -04:00
|
|
|
* @param \Exception|\Throwable $exception
|
2015-09-24 11:01:31 -04:00
|
|
|
* @param array $context
|
|
|
|
|
* @return void
|
|
|
|
|
* @since 8.2.0
|
2020-07-16 13:19:23 -04:00
|
|
|
* @deprecated 20.0.0 use the `exception` entry in the context of any method in \Psr\Log\LoggerInterface
|
2015-09-24 11:01:31 -04:00
|
|
|
*/
|
2018-02-27 04:43:34 -05:00
|
|
|
public function logException(\Throwable $exception, array $context = []);
|
2014-05-06 19:55:06 -04:00
|
|
|
}
|