Arlolra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/214422

Change subject: Make logging mw api warnings configurable
......................................................................

Make logging mw api warnings configurable

Change-Id: I1d0baff72d645947a6e5c4955c629d20148d0686
---
M api/localsettings.js.example
M lib/mediawiki.ApiRequest.js
M lib/mediawiki.ParsoidConfig.js
3 files changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/22/214422/1

diff --git a/api/localsettings.js.example b/api/localsettings.js.example
index 456c7b2..1ca0297 100644
--- a/api/localsettings.js.example
+++ b/api/localsettings.js.example
@@ -96,4 +96,7 @@
        // Leaving it undefined (the default) will use the same URI as the MW 
API,
        // changing api.php for load.php.
        //parsoidConfig.modulesLoadURI = true;
+
+       // Log warnings from the Mediawiki Api (default false)
+       //parsoidConfig.logMwApiWarnings = true;
 };
diff --git a/lib/mediawiki.ApiRequest.js b/lib/mediawiki.ApiRequest.js
index a23acf4..4d01ad7 100644
--- a/lib/mediawiki.ApiRequest.js
+++ b/lib/mediawiki.ApiRequest.js
@@ -22,9 +22,10 @@
 // all revision properties which parsoid is interested in.
 var PARSOID_RVPROP = 
('content|ids|timestamp|user|userid|size|sha1|contentmodel|comment');
 
-var logAPIWarnings = function( request, data ) {
-       if ( data && data.hasOwnProperty( "warnings" ) ) {
-               request.env.log( "warning/api", request.reqType, data.warnings 
);
+var logAPIWarnings = function(request, data) {
+       if (request.env.conf.parsoid.logMwApiWarnings &&
+                       data && data.hasOwnProperty('warnings')) {
+               request.env.log('warning/api', request.reqType, data.warnings);
        }
 };
 
diff --git a/lib/mediawiki.ParsoidConfig.js b/lib/mediawiki.ParsoidConfig.js
index f13031a..8aa98dd 100644
--- a/lib/mediawiki.ParsoidConfig.js
+++ b/lib/mediawiki.ParsoidConfig.js
@@ -286,6 +286,11 @@
 ParsoidConfig.prototype.maxFormSize = 15 * 1024 * 1024;
 
 /**
+ * Log warnings from the Mediawiki Api.
+ */
+ParsoidConfig.prototype.logMwApiWarnings = false;
+
+/**
  * @property {number} How often should we emit a heap sample? Time in ms.
  *
  * Only relevant if performance timing is enabled

-- 
To view, visit https://gerrit.wikimedia.org/r/214422
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d0baff72d645947a6e5c4955c629d20148d0686
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to