Add a PSR-3 based logging interface
authorBryan Davis <bd808@wikimedia.org>
Fri, 21 Mar 2014 04:51:45 +0000 (22:51 -0600)
committerLegoktm <legoktm.wikipedia@gmail.com>
Tue, 14 Oct 2014 00:20:32 +0000 (00:20 +0000)
commit9b3580165087a65029f0107ac973a386e80a23cd
tree35e6ff227c755693d8a2ea861bb1b45c3858c4e3
parent70d3b47b3fb0632da76727138da6b56b69f79df8
Add a PSR-3 based logging interface

The MWLogger class is actually a thin wrapper around any PSR-3
LoggerInterface implementation. Named MWLogger instances can be obtained
from the MWLogger::getInstance() static method. MWLogger expects a class
implementing the MWLoggerSpi interface to act as a factory for new
MWLogger instances. A concrete MWLoggerSpi implementation using the
Monolog library is also provided.

New classes introduced:
; MWLogger
: PSR-3 compatible logger that wraps any \Psr\Log\LoggerInterface
  implementation
; MWLoggerSpi
: Service provider interface for MWLogger factories
; MWLoggerNullSpi
: MWLoggerSpi for creating instances that discard all log events
; MWLoggerMonologSpi
: MWLoggerSpi for creating instances backed by the monolog logging library
; MWLoggerMonologHandler
: Monolog handler that replicates the udp2log and file logging
  functionality of wfErrorLog()
; MWLoggerMonologProcessor
: Monolog log processer that adds host:wfHostname() and wiki:wfWikiID()
  to all records

New globals introduced:
; $wgMWLoggerDefaultSpi
: Default service provider interface to use with MWLogger
; $wgMWLoggerMonologSpiConfig
: Configuration for MWLoggerMonologSpi describing how to configure the
  Monolog logger instances.

This change relies on the Composer managed Psr\Log and Monolog libraries
introduced in Ie667944.

Change-Id: I5c822995a181a38c844f4a13cb172297827e0031
docs/mwlogger.txt [new file with mode: 0644]
includes/AutoLoader.php
includes/DefaultSettings.php
includes/debug/logger/Logger.php [new file with mode: 0644]
includes/debug/logger/NullSpi.php [new file with mode: 0644]
includes/debug/logger/Spi.php [new file with mode: 0644]
includes/debug/logger/monolog/Handler.php [new file with mode: 0644]
includes/debug/logger/monolog/Processor.php [new file with mode: 0644]
includes/debug/logger/monolog/Spi.php [new file with mode: 0644]