Bug 944367 - Use ConsoleAPI to replace Log4moz in account creation. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D99426

--HG--
extra : amend_source : 116f41196360f459dc0eaf996ce13962d97f717b
This commit is contained in:
Ping Chen 2020-12-11 12:50:10 +02:00
Родитель 07bdeb7688
Коммит 44ab4a9754
5 изменённых файлов: 11 добавлений и 26 удалений

Просмотреть файл

@ -24,7 +24,6 @@ var { OAuth2Providers } = ChromeUtils.import(
"resource:///modules/OAuth2Providers.jsm"
);
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
var {
cleanUpHostName,
isLegalHostNameOrIP,
@ -58,14 +57,6 @@ var {
// from http://xyfer.blogspot.com/2005/01/javascript-regexp-email-validator.html
var emailRE = /^[-_a-z0-9\'+*$^&%=~!?{}]+(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*@(?:[-a-z0-9.]+\.[a-z]{2,20}|\d{1,3}(?:\.\d{1,3}){3})(?::\d+)?$/i;
if (typeof gEmailWizardLogger == "undefined") {
var gEmailWizardLogger = Log4Moz.getConfiguredLogger("mail.setup");
gEmailWizardLogger.level = Log4Moz.Level.Info;
gEmailWizardLogger.addAppender(
new Log4Moz.ConsoleAppender(new Log4Moz.BasicFormatter())
); // browser console
}
var gStringsBundle;
var gMessengerBundle;
var gBrandShortName;

Просмотреть файл

@ -108,7 +108,7 @@ function FetchHTTP(url, args, successCallback, errorCallback) {
this._args.timeout = sanitize.integer(args.timeout || 5000); // default 5 seconds
this._successCallback = successCallback;
this._errorCallback = errorCallback;
this._logger = Log4Moz.getConfiguredLogger("mail.setup");
this._logger = gEmailWizardLogger;
this._logger.info("Requesting <" + url + ">");
}
FetchHTTP.prototype = {

Просмотреть файл

@ -5,7 +5,6 @@
/* import-globals-from emailWizard.js */
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
// This is a bit ugly - we set outgoingDone to false
@ -168,7 +167,7 @@ function guessConfig(
}
};
var logger = Log4Moz.getConfiguredLogger("mail.setup");
var logger = gEmailWizardLogger;
var HostTryToAccountServer = function(thisTry, server) {
server.type = protocolToString(thisTry.protocol);
server.hostname = thisTry.hostname;
@ -394,7 +393,7 @@ function HostDetector(progressCallback, successCallback, errorCallback) {
this._hostsToTry = [];
// init logging
this._log = Log4Moz.getConfiguredLogger("mail.wizard");
this._log = gEmailWizardLogger;
this._log.info("created host detector");
}
@ -1004,7 +1003,7 @@ function protocolToString(type) {
/**
* @param thisTry {HostTry}
* @param logger {Log4Moz logger}
* @param logger {ConsoleAPI}
*/
function SSLErrorHandler(thisTry, logger) {
this._try = thisTry;

Просмотреть файл

@ -10,6 +10,7 @@
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
// --------------------------
// Low level, basic functions
@ -668,12 +669,11 @@ function deepCopy(org) {
}
if (typeof gEmailWizardLogger == "undefined") {
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
var gEmailWizardLogger = Log4Moz.getConfiguredLogger("mail.setup");
gEmailWizardLogger.level = Log4Moz.Level.Info;
gEmailWizardLogger.addAppender(
new Log4Moz.ConsoleAppender(new Log4Moz.BasicFormatter())
); // browser console
var gEmailWizardLogger = new ConsoleAPI({
prefix: "mail.setup",
maxLogLevel: "warn",
maxLogLevelPref: "mail.setup.loglevel",
});
}
function ddump(text) {

Просмотреть файл

@ -13,11 +13,6 @@ var { OAuth2Providers } = ChromeUtils.import(
);
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
if (typeof gEmailWizardLogger == "undefined") {
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
var gEmailWizardLogger = Log4Moz.getConfiguredLogger("mail.wizard");
}
/**
* This checks a given config, by trying a real connection and login,
* with username and password.
@ -217,7 +212,7 @@ function urlListener(
this.mErrorCallback = errorCallback;
this.mMsgWindow = msgWindow;
this.mCertError = false;
this._log = Log4Moz.getConfiguredLogger("mail.wizard");
this._log = gEmailWizardLogger;
}
urlListener.prototype = {
OnStartRunningUrl(aUrl) {