Arlolra has uploaded a new change for review.

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

Change subject: s/warning/warn/ to match service-runner's levels
......................................................................

s/warning/warn/ to match service-runner's levels

 * Follow up to b1bf8e05

Change-Id: I40bf2bec8fd4f5c7bbad3d3fe32ab5f1e8c58793
---
M bin/parserTests.js
M lib/api/ParsoidService.js
M lib/config/MWParserEnvironment.js
M lib/config/ParsoidConfig.js
M lib/html2wt/DOMHandlers.js
M lib/html2wt/WikitextSerializer.js
M lib/html2wt/normalizeDOM.js
M lib/html2wt/separators.js
M lib/index.js
M lib/mw/ApiRequest.js
M lib/wt2html/DOMPostProcessor.js
M lib/wt2html/pp/handlers/cleanup.js
M lib/wt2html/pp/processors/computeDSR.js
M lib/wt2html/pp/processors/wrapTemplates.js
14 files changed, 32 insertions(+), 33 deletions(-)


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

diff --git a/bin/parserTests.js b/bin/parserTests.js
index 91c9548..addbb85 100755
--- a/bin/parserTests.js
+++ b/bin/parserTests.js
@@ -305,7 +305,7 @@
        var fetcher = require(__dirname + "/../tools/fetch-parserTests.txt.js");
        if (!fetcher.isUpToDate()) {
                parserTestsUpToDate = false;
-               console.warn("warning", "ParserTests.txt not up-to-date with 
upstream.");
+               console.warn("warn", "ParserTests.txt not up-to-date with 
upstream.");
        }
 
        // Startup by loading .txt test file
@@ -1114,7 +1114,7 @@
                                        item.resultWT = wt;
                                } else {
                                        // FIXME: what's going on here? Error 
handling here is suspect.
-                                       self.env.log('warning', 'Convert 
html2wt erred!');
+                                       self.env.log('warn', 'Convert html2wt 
erred!');
                                        item.resultWT = item.wikitext;
                                }
                                return checkAndReturn();
@@ -1698,7 +1698,7 @@
 
                // Enable sampling to assert it's working while testing.
                parsoidConfig.loggerSampling = [
-                       [/^warning(\/|$)/, 100],
+                       [/^warn(\/|$)/, 100],
                ];
 
                parsoidConfig.timeouts.mwApi.connect = 10000;
@@ -2124,10 +2124,10 @@
                                        setImmediate(nextCallback);
                                        break;
                                case 'hooks':
-                                       this.env.log('warning', 'parserTests: 
Unhandled extension hook', JSON.stringify(item));
+                                       this.env.log('warn', 'parserTests: 
Unhandled extension hook', JSON.stringify(item));
                                        break;
                                case 'functionhooks':
-                                       this.env.log("warning", "parserTests: 
Unhandled functionhook", JSON.stringify(item));
+                                       this.env.log("warn", "parserTests: 
Unhandled functionhook", JSON.stringify(item));
                                        break;
                                default:
                                        this.comments = [];
diff --git a/lib/api/ParsoidService.js b/lib/api/ParsoidService.js
index eafeb3e..399a3ed 100644
--- a/lib/api/ParsoidService.js
+++ b/lib/api/ParsoidService.js
@@ -122,7 +122,7 @@
        // Log unhandleds errors passed along with our logger.
        var logError = function(err, req, res) {
                var logger = res.locals.env ? res.locals.env.logger : 
processLogger;
-               var args = ['warning', req.method, req.originalUrl, err];
+               var args = ['warn', req.method, req.originalUrl, err];
                if (err.type === 'entity.too.large') {
                        // Add the expected length of the stream.
                        args.push('expected: ' + err.expected);
diff --git a/lib/config/MWParserEnvironment.js 
b/lib/config/MWParserEnvironment.js
index 8fe1188..2351b71 100644
--- a/lib/config/MWParserEnvironment.js
+++ b/lib/config/MWParserEnvironment.js
@@ -256,7 +256,7 @@
        this.setLogger(logger);
 
        var defaultLogLevels = [
-               "fatal", "error", "warning", "info",
+               "fatal", "error", "warn", "info",
        ];
 
        if (this.conf.parsoid.linting && !this.conf.parsoid.linterSendAPI) {
@@ -700,7 +700,7 @@
 MWParserEnvironment.prototype.getModulesLoadURI = function() {
        var modulesLoadURI = this.conf.parsoid.modulesLoadURI;
        if (modulesLoadURI === true) {
-               this.log('warning',
+               this.log('warn',
                        'Setting `modulesLoadURI` to `true` is no longer 
supported.');
                modulesLoadURI = undefined;
        }
@@ -762,7 +762,7 @@
                        'wikitext';
        if (!this.conf.wiki.extContentModel.has(contentmodel)) {
                if (!whitelist.has(contentmodel)) {
-                       this.log('warning', 'Unknown contentmodel', 
contentmodel);
+                       this.log('warn', 'Unknown contentmodel', contentmodel);
                }
                contentmodel = 'wikitext';
        }
diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js
index 4b73ce8..e43952d 100644
--- a/lib/config/ParsoidConfig.js
+++ b/lib/config/ParsoidConfig.js
@@ -254,7 +254,7 @@
  * Omissions imply 100.
  * For example,
  *   parsoidConfig.loggerSampling = [
- *     ['warning/dsr/inconsistent', 1],
+ *     ['warn/dsr/inconsistent', 1],
  *   ];
  */
 ParsoidConfig.prototype.loggerSampling = null;
diff --git a/lib/html2wt/DOMHandlers.js b/lib/html2wt/DOMHandlers.js
index 25cf472..68cb26a 100644
--- a/lib/html2wt/DOMHandlers.js
+++ b/lib/html2wt/DOMHandlers.js
@@ -1027,7 +1027,7 @@
                                                                        "$1" + 
contentInfo.value + "}}");
                                                        } else {
                                                                var magicWord = 
cat[1].toUpperCase();
-                                                               
state.env.log("warning", cat[1] +
+                                                               
state.env.log("warn", cat[1] +
                                                                        ' is 
missing source. Rendering as ' +
                                                                        
magicWord + ' magicword');
                                                                return "{{" + 
magicWord + ":" +
@@ -1180,7 +1180,7 @@
                                                !kvs.length) {
                                        // Discard span wrappers added to flag 
misnested content.
                                        // Warn since selser should have reused 
source.
-                                       state.env.log('warning',
+                                       state.env.log('warn',
                                                'Serializing misnested content: 
' + node.outerHTML);
                                        return state.serializeChildren(node);
                                } else {
diff --git a/lib/html2wt/WikitextSerializer.js 
b/lib/html2wt/WikitextSerializer.js
index c7d97fc..1446740 100644
--- a/lib/html2wt/WikitextSerializer.js
+++ b/lib/html2wt/WikitextSerializer.js
@@ -259,7 +259,7 @@
                // for this id.
                if (k === "id" && /^mw[\w-]{2,}$/.test(kv.v)) {
                        if (DU.isNewElt(node)) {
-                               this.env.log("warning/html2wt",
+                               this.env.log("warn/html2wt",
                                        "Parsoid id found on element without a 
matching data-parsoid " +
                                        "entry: ID=" + kv.v + "; ELT=" + 
node.outerHTML);
                        } else {
diff --git a/lib/html2wt/normalizeDOM.js b/lib/html2wt/normalizeDOM.js
index d14f942..4881e59 100644
--- a/lib/html2wt/normalizeDOM.js
+++ b/lib/html2wt/normalizeDOM.js
@@ -271,7 +271,7 @@
 
                if (oldLength !== newLength) {
                        // Log changes for editors benefit
-                       this.env.log('warning/html2wt/bidi',
+                       this.env.log('warn/html2wt/bidi',
                                'LRM/RLM unicode chars stripped around 
categories');
                }
 
diff --git a/lib/html2wt/separators.js b/lib/html2wt/separators.js
index b686003..880b1aa 100644
--- a/lib/html2wt/separators.js
+++ b/lib/html2wt/separators.js
@@ -89,7 +89,7 @@
                if (b.min !== undefined) {
                        if (nlConstraints.max !== undefined && 
nlConstraints.max < b.min) {
                                // Conflict, warn and let nodeB win.
-                               env.log("warning", "Incompatible constraints 
1:", nodeA.nodeName,
+                               env.log("warn", "Incompatible constraints 1:", 
nodeA.nodeName,
                                                nodeB.nodeName, 
loggableConstraints(nlConstraints));
                                nlConstraints.min = b.min;
                                nlConstraints.max = b.min;
@@ -101,7 +101,7 @@
                if (b.max !== undefined) {
                        if (nlConstraints.min !== undefined && 
nlConstraints.min > b.max) {
                                // Conflict, warn and let nodeB win.
-                               env.log("warning", "Incompatible constraints 
2:", nodeA.nodeName,
+                               env.log("warn", "Incompatible constraints 2:", 
nodeA.nodeName,
                                                nodeB.nodeName, 
loggableConstraints(nlConstraints));
                                nlConstraints.min = b.max;
                                nlConstraints.max = b.max;
@@ -277,7 +277,7 @@
                }
 
                res.max = res.min;
-               env.log("warning", 'Incompatible constraints (merge):', res,
+               env.log("warn", 'Incompatible constraints (merge):', res,
                        loggableConstraints(oldConstraints), 
loggableConstraints(newConstraints));
        }
        return res;
@@ -628,7 +628,7 @@
                                        sep = src.substring(dsrA[1], dsrB[1] - 
dsrB[3]);
                                }
                        } else {
-                               this.env.log("warning", "dsr backwards: should 
not happen!");
+                               this.env.log("warn", "dsr backwards: should not 
happen!");
                        }
 
                        if (state.sep.lastSourceSep) {
diff --git a/lib/index.js b/lib/index.js
index 0850b6b..b873ad4 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -174,8 +174,7 @@
        // By default, set the loggerBackend and metrics to service-runner's.
        var parsoidOptions = {
                loggerBackend: function(logData, cb) {
-                       var type = logData.logType.replace(/^warning/, 'warn');
-                       type = type.replace(/^lint/, 'info/lint');
+                       var type = logData.logType.replace(/^lint/, 
'info/lint');
                        options.logger.log(type, prepareLog(logData));
                        cb();
                },
diff --git a/lib/mw/ApiRequest.js b/lib/mw/ApiRequest.js
index a33f7ca..423a278 100644
--- a/lib/mw/ApiRequest.js
+++ b/lib/mw/ApiRequest.js
@@ -88,7 +88,7 @@
                        if (re instanceof RegExp && re.test(msg)) {
                                return; // suppress this message
                        }
-                       req.env.log('warning/api/' + apiModule, req.reqType, 
msg);
+                       req.env.log('warn/api/' + apiModule, req.reqType, msg);
                });
        }
 };
@@ -120,7 +120,7 @@
                // For backwards compatibility. Older wikis still put the data 
here.
                src = response["*"];
        } else {
-               env.log('warning/api', "Invalid API preprocessor response");
+               env.log('warn/api', "Invalid API preprocessor response");
        }
 
        // Add the categories which were added by parser functions directly
@@ -159,7 +159,7 @@
        } else if (response.text['*'] !== undefined) {
                parsedHtml = response.text['*'];
        } else {
-               env.log('warning/api', "Invalid API parser response");
+               env.log('warn/api', "Invalid API parser response");
        }
        // Strip two trailing newlines that action=parse adds after any
        // extension output
@@ -378,7 +378,7 @@
 ApiRequest.prototype._requestCB = function(error, response, body) {
        if (error) {
                this.trace("Received error:", error);
-               this.env.log('warning/api' + (error.code ? ("/" + 
error.code).toLowerCase() : ''),
+               this.env.log('warn/api' + (error.code ? ("/" + 
error.code).toLowerCase() : ''),
                        'Failed API request,', {
                                "error": error,
                                "status": response && response.statusCode,
@@ -404,7 +404,7 @@
                if (response.statusCode === 412) {
                        this.env.log("info", "Cache MISS:", 
response.request.href);
                } else {
-                       this.env.log("warning", "non-200 response:", 
response.statusCode, body);
+                       this.env.log("warn", "non-200 response:", 
response.statusCode, body);
                }
                error = new Error(this.reqType + ' failure for '
                                        + 
JSON.stringify(this.queueKey.substr(0, 80)) + ': ' + response.statusCode);
@@ -434,7 +434,7 @@
        try {
                // Strip the UTF8 BOM since it knowingly breaks parsing.
                if (body[0] === '\uFEFF') {
-                       this.env.log('warning', 'Stripping a UTF8 BOM. Your 
webserver is' +
+                       this.env.log('warn', 'Stripping a UTF8 BOM. Your 
webserver is' +
                                ' likely broken.');
                        body = body.slice(1);
                }
diff --git a/lib/wt2html/DOMPostProcessor.js b/lib/wt2html/DOMPostProcessor.js
index 35f7d58..debc101 100644
--- a/lib/wt2html/DOMPostProcessor.js
+++ b/lib/wt2html/DOMPostProcessor.js
@@ -227,7 +227,7 @@
                                try {
                                        meta.setAttribute(attr.nodeName, 
attr.nodeValue);
                                } catch (e) {
-                                       env.log("warning", "prepareDOM: Dropped 
invalid attribute",
+                                       env.log("warn", "prepareDOM: Dropped 
invalid attribute",
                                                attr.nodeName);
                                }
                        });
diff --git a/lib/wt2html/pp/handlers/cleanup.js 
b/lib/wt2html/pp/handlers/cleanup.js
index 3c86dd3..8c35d8f 100644
--- a/lib/wt2html/pp/handlers/cleanup.js
+++ b/lib/wt2html/pp/handlers/cleanup.js
@@ -51,7 +51,7 @@
        if (!node.firstChild && node !== tplInfo.first &&
                node.nodeName in {'TR': 1, 'LI': 1} && node.attributes.length 
=== 0
        ) {
-               env.log('warning/empty/' + node.nodeName.toLowerCase(),
+               env.log('warn/empty/' + node.nodeName.toLowerCase(),
                        'Template', DU.findEnclosingTemplateName(tplInfo),
                        'produces stripped empty elements');
                var nextNode = node.nextSibling;
diff --git a/lib/wt2html/pp/processors/computeDSR.js 
b/lib/wt2html/pp/processors/computeDSR.js
index 76129df..aa49fcc 100644
--- a/lib/wt2html/pp/processors/computeDSR.js
+++ b/lib/wt2html/pp/processors/computeDSR.js
@@ -459,7 +459,7 @@
                        if (cs !== null || ce !== null) {
                                if (ce < 0) {
                                        if (!fosteredNode) {
-                                               env.log("warning/dsr/negative", 
"Negative DSR for node: " + node.nodeName + "; resetting to zero");
+                                               env.log("warn/dsr/negative", 
"Negative DSR for node: " + node.nodeName + "; resetting to zero");
                                        }
                                        ce = 0;
                                }
@@ -618,7 +618,7 @@
 
        // Detect errors
        if (s !== null && s !== undefined && cs !== s && 
!acceptableInconsistency(opts, node, cs, s)) {
-               env.log("warning/dsr/inconsistent", "DSR inconsistency: cs/s 
mismatch for node:",
+               env.log("warn/dsr/inconsistent", "DSR inconsistency: cs/s 
mismatch for node:",
                        node.nodeName, "s:", s, "; cs:", cs);
        }
 
diff --git a/lib/wt2html/pp/processors/wrapTemplates.js 
b/lib/wt2html/pp/processors/wrapTemplates.js
index a105ce6..c6d8797 100644
--- a/lib/wt2html/pp/processors/wrapTemplates.js
+++ b/lib/wt2html/pp/processors/wrapTemplates.js
@@ -642,7 +642,7 @@
 
                if (range.flipped) {
                        // FIXME: The code below needs to be aware of flipped 
ranges.
-                       env.log('warning/template',
+                       env.log('warn/template',
                                'Encapsulating a flipped range: ' + range.id);
                }
 
@@ -931,11 +931,11 @@
                                                if (aboutRef.end) {
                                                        // End marker was 
foster-parented.
                                                        // Found actual start 
tag.
-                                                       
env.log("warning/template", 'end marker was foster-parented for', about);
+                                                       
env.log("warn/template", 'end marker was foster-parented for', about);
                                                        
tplRanges.push(getDOMRange(env, doc, elem, aboutRef.end, aboutRef.end));
                                                } else {
                                                        // should not happen!
-                                                       
env.log("warning/template", 'start found after content for', about);
+                                                       
env.log("warn/template", 'start found after content for', about);
                                                }
                                        } else {
                                                tpls[about] = { start: elem };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40bf2bec8fd4f5c7bbad3d3fe32ab5f1e8c58793
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to