Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/213011
Change subject: [WIP] XMP: Use structured logging instead of wfDebugLog
......................................................................
[WIP] XMP: Use structured logging instead of wfDebugLog
Change-Id: I486192a718576a4d1e585ffb390e297b14dde087
---
M includes/media/XMP.php
1 file changed, 20 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/11/213011/1
diff --git a/includes/media/XMP.php b/includes/media/XMP.php
index 957ddd2..2d7af27 100644
--- a/includes/media/XMP.php
+++ b/includes/media/XMP.php
@@ -21,6 +21,10 @@
* @ingroup Media
*/
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
+
/**
* Class for reading xmp data containing properties relevant to
* images, and spitting out an array that FormatMetadata accepts.
@@ -46,7 +50,7 @@
* read rdf.
*
*/
-class XMPReader {
+class XMPReader implements LoggerAwareInterface {
/** @var array XMP item configuration array */
protected $items;
@@ -121,22 +125,36 @@
const PARSABLE_NO = 3;
/**
+ * @var LoggerInterface
+ */
+ private $logger;
+
+ /**
* Constructor.
*
* Primary job is to initialize the XMLParser
*/
- function __construct() {
+ function __construct( LoggerInterface $logger = null ) {
if ( !function_exists( 'xml_parser_create_ns' ) ) {
// this should already be checked by this point
throw new RuntimeException( 'XMP support requires XML
Parser' );
}
+ if ( $logger ) {
+ $this->setLogger( $logger );
+ } else {
+ $this->setLogger( new NullLogger() );
+ }
$this->items = XMPInfo::getItems();
$this->resetXMLParser();
}
+ public function setLogger( LoggerInterface $logger ) {
+ $this->logger = $logger;
+ }
+
/**
* Main use is if a single item has multiple xmp documents describing
it.
* For example in jpeg's with extendedXMP
--
To view, visit https://gerrit.wikimedia.org/r/213011
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I486192a718576a4d1e585ffb390e297b14dde087
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits