Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / debug / logger / Spi.php
blobf7d3185e63a6ad3d582bff47ca7f6bf172bc74d9
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
18 * @file
21 namespace MediaWiki\Logger;
23 /**
24 * @defgroup Debug Debug logging
26 * To primary APIs for this feature, and the classes where their documentation
27 * starts, are:
29 * - MediaWiki\Logger\LoggerFactory, this creates all logger objects at
30 * run time.
32 * - MediaWiki\Logger\Spi, to develop or configure the service classes
33 * that internally create logger objects. For example, MediaWiki\Logger\LegacyLogger
34 * is the default Spi that backs features like $wgDebugLogFile.
35 * MediaWiki\Logger\MonologSpi is an Spi you can opt-in to via $wgMWLoggerDefaultSpi
36 * to enable structured logging with destinations like Syslog and Logstash,
37 * and "processor" and "formatter" features to augment messages with metadata,
38 * as powered by the Monolog library.
40 * - MWDebug, the logic behind $wgDebugToolbar.
42 * @see [Logger documentation](@ref debuglogger) in docs/Logger.md
45 /**
46 * Service provider interface to create \Psr\Log\LoggerInterface objects.
48 * MediaWiki can be configured to use a class implementing this interface
49 * via the $wgMWLoggerDefaultSpi configuration variable.
51 * This configuration is consumed by MediaWiki\Logger\LoggerFactory, which is
52 * where we create logger objects.
54 * While not recommended in production code, you can construct and install
55 * an Spi class at runtime via MediaWiki\Logger\LoggerFactory::registerProvider
56 * (e.g. to power debug features in PHPUnit bootstrapping, or Maintenance
57 * scripts).
59 * @stable to implement
60 * @since 1.25
61 * @ingroup Debug
62 * @copyright © 2014 Wikimedia Foundation and contributors
64 interface Spi {
66 /**
67 * Get a logger instance.
69 * @param string $channel Logging channel
70 * @return \Psr\Log\LoggerInterface Logger instance
72 public function getLogger( $channel );