mirror of
https://github.com/moparisthebest/FireTray
synced 2024-11-17 22:35:02 -05:00
* adapt to Log4Moz -> Log renaming (FF 27+)
* fix typo (Cu.reportError)
This commit is contained in:
parent
b453b4fa74
commit
8f8fad3afc
@ -45,5 +45,5 @@ osvi.dwOSVersionInfoSize = kernel32.OSVERSIONINFOEXW.size;
|
||||
if (kernel32.GetVersionExW(osvi.address())) {
|
||||
win32.WINVER = (+osvi.dwMajorVersion)*10 + (+osvi.dwMinorVersion); // ctypes.UInt64 objects!
|
||||
} else {
|
||||
Cu.ReportError("win version not found");
|
||||
Cu.reportError("win version not found");
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ var colorTermLogColors = {
|
||||
if ("undefined" == typeof(firetray)) {
|
||||
var firetray = {};
|
||||
};
|
||||
var LogMod;
|
||||
|
||||
// https://wiki.mozilla.org/Labs/JS_Modules#Logging
|
||||
firetray.Logging = {
|
||||
@ -55,17 +56,22 @@ firetray.Logging = {
|
||||
init: function() {
|
||||
if (this.initialized) return;
|
||||
|
||||
["resource://services-common/log4moz.js", // FF
|
||||
"resource:///app/modules/gloda/log4moz.js", // TB
|
||||
"resource://firetray/log4moz.js"] // default
|
||||
["resource://gre/modules/Log.jsm", // FF 27+
|
||||
"resource://services-common/log4moz.js", // FF
|
||||
"resource:///app/modules/gloda/log4moz.js", // TB
|
||||
"resource://firetray/log4moz.js"] // default
|
||||
.forEach(function(file){
|
||||
try {Cu.import(file);} catch(x) {}
|
||||
}, this);
|
||||
|
||||
if ("undefined" == typeof(Log4Moz)) {
|
||||
let errMsg = "log4moz.js not found";
|
||||
if ("undefined" != typeof(Log)) {
|
||||
LogMod = Log;
|
||||
} else if ("undefined" != typeof(Log4Moz)) {
|
||||
LogMod = Log4Moz;
|
||||
} else {
|
||||
let errMsg = "Log module not found";
|
||||
dump(errMsg+"\n");
|
||||
Cu.ReportError(errMsg);
|
||||
Cu.reportError(errMsg);
|
||||
};
|
||||
|
||||
this.setupLogging("firetray");
|
||||
@ -81,7 +87,7 @@ firetray.Logging = {
|
||||
// lifted from log4moz.js
|
||||
function SimpleFormatter() {}
|
||||
SimpleFormatter.prototype = {
|
||||
__proto__: Log4Moz.Formatter.prototype,
|
||||
__proto__: LogMod.Formatter.prototype,
|
||||
|
||||
format: function(message) {
|
||||
let messageString = "";
|
||||
@ -122,14 +128,14 @@ firetray.Logging = {
|
||||
};
|
||||
|
||||
// Loggers are hierarchical, affiliation is handled by a '.' in the name.
|
||||
this._logger = Log4Moz.repository.getLogger(loggerName);
|
||||
this._logger = LogMod.repository.getLogger(loggerName);
|
||||
// Lowering this log level will affect all of our addon output
|
||||
this._logger.level = Log4Moz.Level[FIRETRAY_LOG_LEVEL];
|
||||
this._logger.level = LogMod.Level[FIRETRAY_LOG_LEVEL];
|
||||
|
||||
// A console appender outputs to the JS Error Console
|
||||
let simpleFormatter = new SimpleFormatter();
|
||||
let capp = new Log4Moz.ConsoleAppender(simpleFormatter);
|
||||
capp.level = Log4Moz.Level["Debug"];
|
||||
let capp = new LogMod.ConsoleAppender(simpleFormatter);
|
||||
capp.level = LogMod.Level["Debug"];
|
||||
this._logger.addAppender(capp);
|
||||
|
||||
// A dump appender outputs to standard out
|
||||
@ -139,13 +145,13 @@ firetray.Logging = {
|
||||
} else {
|
||||
dumpFormatter = new SimpleFormatter();
|
||||
}
|
||||
let dapp = new Log4Moz.DumpAppender(dumpFormatter);
|
||||
dapp.level = Log4Moz.Level["Debug"];
|
||||
let dapp = new LogMod.DumpAppender(dumpFormatter);
|
||||
dapp.level = LogMod.Level["Debug"];
|
||||
this._logger.addAppender(dapp);
|
||||
},
|
||||
|
||||
getLogger: function(loggerName){
|
||||
return Log4Moz.repository.getLogger(loggerName);
|
||||
return LogMod.repository.getLogger(loggerName);
|
||||
}
|
||||
|
||||
}; // firetray.Logging
|
||||
|
Loading…
Reference in New Issue
Block a user