diff --git a/mail/components/newmailaccount/content/accountProvisioner.js b/mail/components/newmailaccount/content/accountProvisioner.js index ce22129617..c4011d0ceb 100644 --- a/mail/components/newmailaccount/content/accountProvisioner.js +++ b/mail/components/newmailaccount/content/accountProvisioner.js @@ -7,6 +7,7 @@ var { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm" ); +var { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm"); var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var { XPCOMUtils } = ChromeUtils.import( "resource://gre/modules/XPCOMUtils.jsm" @@ -17,11 +18,14 @@ var { PluralForm } = ChromeUtils.import( var { MailServices } = ChromeUtils.import( "resource:///modules/MailServices.jsm" ); -var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm"); // Get a configured logger for this component. // 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( "chrome://messenger/locale/newmailaccount/accountProvisioner.properties" ); diff --git a/mail/components/newmailaccount/content/accountProvisionerTab.js b/mail/components/newmailaccount/content/accountProvisionerTab.js index 0b8bb7f2b6..0b5dd1bf51 100644 --- a/mail/components/newmailaccount/content/accountProvisionerTab.js +++ b/mail/components/newmailaccount/content/accountProvisionerTab.js @@ -8,7 +8,7 @@ /* globals specialTabs */ 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 @@ -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", + }), + }, }); /** diff --git a/mailnews/base/src/MailNotificationService.jsm b/mailnews/base/src/MailNotificationService.jsm index 9cb671d950..173c712173 100644 --- a/mailnews/base/src/MailNotificationService.jsm +++ b/mailnews/base/src/MailNotificationService.jsm @@ -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 * 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/. */ @@ -6,15 +6,13 @@ /* platform-independent code to count new and unread messages and pass the information to * platform-specific notification modules * - * Logging for this module uses the TB version of log4moz. Default logging is at the Warn - * level. Other possibly interesting messages are at Error, Info and Debug. To configure, set the - * preferences "mail.notification.logging.console" (for the error console) or - * "mail.notification.logging.dump" (for stderr) to the string indicating the level you want. + * Default logging is at the Warn level. Other possibly interesting messages are + * at Error, Info and Debug. To configure, set the preferences + * "mail.notification.loglevel" to the string indicating the level you want. */ var EXPORTED_SYMBOLS = ["NewMailNotificationService"]; -var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm"); var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var { MailServices } = ChromeUtils.import( "resource:///modules/MailServices.jsm" @@ -44,12 +42,11 @@ function NewMailNotificationService() { this._listeners = []; this.wrappedJSObject = this; - this._log = Log4Moz.getConfiguredLogger( - "mail.notification", - Log4Moz.Level.Warn, - Log4Moz.Level.Warn, - Log4Moz.Level.Warn - ); + this._log = console.createInstance({ + prefix: "mail.notification", + maxLogLevel: "Warn", + maxLogLevelPref: "mail.notification.loglevel", + }); // Listen for mail-startup-done to do the rest of our setup after folders are initialized Services.obs.addObserver(this, "mail-startup-done"); diff --git a/mailnews/base/src/MsgAsyncPrompter.jsm b/mailnews/base/src/MsgAsyncPrompter.jsm index a7d576d1a2..88bfc34f84 100644 --- a/mailnews/base/src/MsgAsyncPrompter.jsm +++ b/mailnews/base/src/MsgAsyncPrompter.jsm @@ -8,7 +8,6 @@ var { Deprecated } = ChromeUtils.import( "resource://gre/modules/Deprecated.jsm" ); var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); -var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm"); function runnablePrompter(asyncPrompter, hashKey) { this._asyncPrompter = asyncPrompter; @@ -80,17 +79,16 @@ runnablePrompter.prototype = { function MsgAsyncPrompter() { this._pendingPrompts = {}; - // By default, only log warnings to the error console and errors to dump(). - // You can use the preferences: - // msgAsyncPrompter.logging.console - // msgAsyncPrompter.logging.dump + // By default, only log warnings to the error console + // You can use the preference: + // msgAsyncPrompter.loglevel // To change this up. Values should be one of: // Fatal/Error/Warn/Info/Config/Debug/Trace/All - this._log = Log4Moz.getConfiguredLogger( - "msgAsyncPrompter", - Log4Moz.Level.Warn, - Log4Moz.Level.Warn - ); + this._log = console.createInstance({ + prefix: "msgAsyncPrompter", + maxLogLevel: "Warn", + maxLogLevelPref: "msgAsyncPrompter.loglevel", + }); } MsgAsyncPrompter.prototype = { diff --git a/mailnews/base/src/MsgDBCacheManager.jsm b/mailnews/base/src/MsgDBCacheManager.jsm index 4b01da4b2e..ee1dbad6da 100644 --- a/mailnews/base/src/MsgDBCacheManager.jsm +++ b/mailnews/base/src/MsgDBCacheManager.jsm @@ -14,8 +14,12 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); var { MailServices } = ChromeUtils.import( "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", +}); /** */ diff --git a/mailnews/base/src/OAuth2.jsm b/mailnews/base/src/OAuth2.jsm index d5ccda5d8f..daeea871fb 100644 --- a/mailnews/base/src/OAuth2.jsm +++ b/mailnews/base/src/OAuth2.jsm @@ -9,7 +9,6 @@ var EXPORTED_SYMBOLS = ["OAuth2"]; const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); -const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm"); Cu.importGlobalProperties(["fetch"]); @@ -46,7 +45,11 @@ function OAuth2( this.extraAuthParams = []; - this.log = Log4Moz.getConfiguredLogger("TBOAuth"); + this.log = console.createInstance({ + prefix: "TBOAuth", + maxLogLevel: "Warn", + maxLogLevelPref: "TBOAuth.loglevel", + }); } OAuth2.prototype = { diff --git a/mailnews/mailnews.js b/mailnews/mailnews.js index a110c3cb98..c543696c4f 100644 --- a/mailnews/mailnews.js +++ b/mailnews/mailnews.js @@ -757,7 +757,7 @@ pref("rss.show.content-base", 0); // 1 - load web page in default browser, on select pref("rss.message.loadWebPageOnSelect", 0); -pref("Feeds.loglevel", "Info"); +pref("Feeds.loglevel", "Warn"); // 0=default as attachment // 1=forward as quoted (mapped to 2 in mozilla) @@ -1107,3 +1107,5 @@ pref("mail.imap.qos", 0); // PgpMime Addon pref("mail.pgpmime.addon_url", "https://addons.mozilla.org/addon/enigmail/"); + +pref("msgAsyncPrompter.loglevel", "Warn");