Bug 944367 - Remove Log4Moz from newmailaccount and mailnews/base. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D99755
This commit is contained in:
Ping Chen 2020-12-16 05:03:19 +00:00
Родитель 4f08f7a16c
Коммит fa9d012f66
7 изменённых файлов: 45 добавлений и 31 удалений

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

@ -7,6 +7,7 @@
var { AppConstants } = ChromeUtils.import( var { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm" "resource://gre/modules/AppConstants.jsm"
); );
var { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { XPCOMUtils } = ChromeUtils.import( var { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm" "resource://gre/modules/XPCOMUtils.jsm"
@ -17,11 +18,14 @@ var { PluralForm } = ChromeUtils.import(
var { MailServices } = ChromeUtils.import( var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm" "resource:///modules/MailServices.jsm"
); );
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
// Get a configured logger for this component. // Get a configured logger for this component.
// To debug, set mail.provider.logging.dump (or .console)="All" // To debug, set mail.provider.logging.dump (or .console)="All"
var gLog = Log4Moz.getConfiguredLogger("mail.provider"); var gLog = new ConsoleAPI({
prefix: "mail.provider",
maxLogLevel: "warn",
maxLogLevelPref: "mail.provider.loglevel",
});
var stringBundle = Services.strings.createBundle( var stringBundle = Services.strings.createBundle(
"chrome://messenger/locale/newmailaccount/accountProvisioner.properties" "chrome://messenger/locale/newmailaccount/accountProvisioner.properties"
); );

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

@ -8,7 +8,7 @@
/* globals specialTabs */ /* globals specialTabs */
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm"); var { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
/** /**
* A content tab for the account provisioner. We use Javascript-y magic to * A content tab for the account provisioner. We use Javascript-y magic to
@ -27,7 +27,13 @@ var accountProvisionerTabType = Object.create(specialTabs.contentTabType, {
}, },
}, },
}, },
_log: { value: Log4Moz.getConfiguredLogger("mail.provider") }, _log: {
value: new ConsoleAPI({
prefix: "mail.provider",
maxLogLevel: "warn",
maxLogLevelPref: "mail.provider.loglevel",
}),
},
}); });
/** /**

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

@ -1,4 +1,4 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -6,15 +6,13 @@
/* platform-independent code to count new and unread messages and pass the information to /* platform-independent code to count new and unread messages and pass the information to
* platform-specific notification modules * platform-specific notification modules
* *
* Logging for this module uses the TB version of log4moz. Default logging is at the Warn * Default logging is at the Warn level. Other possibly interesting messages are
* level. Other possibly interesting messages are at Error, Info and Debug. To configure, set the * at Error, Info and Debug. To configure, set the preferences
* preferences "mail.notification.logging.console" (for the error console) or * "mail.notification.loglevel" to the string indicating the level you want.
* "mail.notification.logging.dump" (for stderr) to the string indicating the level you want.
*/ */
var EXPORTED_SYMBOLS = ["NewMailNotificationService"]; var EXPORTED_SYMBOLS = ["NewMailNotificationService"];
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import( var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm" "resource:///modules/MailServices.jsm"
@ -44,12 +42,11 @@ function NewMailNotificationService() {
this._listeners = []; this._listeners = [];
this.wrappedJSObject = this; this.wrappedJSObject = this;
this._log = Log4Moz.getConfiguredLogger( this._log = console.createInstance({
"mail.notification", prefix: "mail.notification",
Log4Moz.Level.Warn, maxLogLevel: "Warn",
Log4Moz.Level.Warn, maxLogLevelPref: "mail.notification.loglevel",
Log4Moz.Level.Warn });
);
// Listen for mail-startup-done to do the rest of our setup after folders are initialized // Listen for mail-startup-done to do the rest of our setup after folders are initialized
Services.obs.addObserver(this, "mail-startup-done"); Services.obs.addObserver(this, "mail-startup-done");

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

@ -8,7 +8,6 @@ var { Deprecated } = ChromeUtils.import(
"resource://gre/modules/Deprecated.jsm" "resource://gre/modules/Deprecated.jsm"
); );
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
function runnablePrompter(asyncPrompter, hashKey) { function runnablePrompter(asyncPrompter, hashKey) {
this._asyncPrompter = asyncPrompter; this._asyncPrompter = asyncPrompter;
@ -80,17 +79,16 @@ runnablePrompter.prototype = {
function MsgAsyncPrompter() { function MsgAsyncPrompter() {
this._pendingPrompts = {}; this._pendingPrompts = {};
// By default, only log warnings to the error console and errors to dump(). // By default, only log warnings to the error console
// You can use the preferences: // You can use the preference:
// msgAsyncPrompter.logging.console // msgAsyncPrompter.loglevel
// msgAsyncPrompter.logging.dump
// To change this up. Values should be one of: // To change this up. Values should be one of:
// Fatal/Error/Warn/Info/Config/Debug/Trace/All // Fatal/Error/Warn/Info/Config/Debug/Trace/All
this._log = Log4Moz.getConfiguredLogger( this._log = console.createInstance({
"msgAsyncPrompter", prefix: "msgAsyncPrompter",
Log4Moz.Level.Warn, maxLogLevel: "Warn",
Log4Moz.Level.Warn maxLogLevelPref: "msgAsyncPrompter.loglevel",
); });
} }
MsgAsyncPrompter.prototype = { MsgAsyncPrompter.prototype = {

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

@ -14,8 +14,12 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import( var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm" "resource:///modules/MailServices.jsm"
); );
var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
var log = Log4Moz.getConfiguredLogger("mailnews.database.dbcache"); var log = console.createInstance({
prefix: "dbcache",
maxLogLevel: "Warn",
maxLogLevelPref: "mailnews.database.dbcache.loglevel",
});
/** /**
*/ */

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

@ -9,7 +9,6 @@
var EXPORTED_SYMBOLS = ["OAuth2"]; var EXPORTED_SYMBOLS = ["OAuth2"];
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
Cu.importGlobalProperties(["fetch"]); Cu.importGlobalProperties(["fetch"]);
@ -46,7 +45,11 @@ function OAuth2(
this.extraAuthParams = []; this.extraAuthParams = [];
this.log = Log4Moz.getConfiguredLogger("TBOAuth"); this.log = console.createInstance({
prefix: "TBOAuth",
maxLogLevel: "Warn",
maxLogLevelPref: "TBOAuth.loglevel",
});
} }
OAuth2.prototype = { OAuth2.prototype = {

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

@ -757,7 +757,7 @@ pref("rss.show.content-base", 0);
// 1 - load web page in default browser, on select // 1 - load web page in default browser, on select
pref("rss.message.loadWebPageOnSelect", 0); pref("rss.message.loadWebPageOnSelect", 0);
pref("Feeds.loglevel", "Info"); pref("Feeds.loglevel", "Warn");
// 0=default as attachment // 0=default as attachment
// 1=forward as quoted (mapped to 2 in mozilla) // 1=forward as quoted (mapped to 2 in mozilla)
@ -1107,3 +1107,5 @@ pref("mail.imap.qos", 0);
// PgpMime Addon // PgpMime Addon
pref("mail.pgpmime.addon_url", "https://addons.mozilla.org/addon/enigmail/"); pref("mail.pgpmime.addon_url", "https://addons.mozilla.org/addon/enigmail/");
pref("msgAsyncPrompter.loglevel", "Warn");