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())) {
|
if (kernel32.GetVersionExW(osvi.address())) {
|
||||||
win32.WINVER = (+osvi.dwMajorVersion)*10 + (+osvi.dwMinorVersion); // ctypes.UInt64 objects!
|
win32.WINVER = (+osvi.dwMajorVersion)*10 + (+osvi.dwMinorVersion); // ctypes.UInt64 objects!
|
||||||
} else {
|
} else {
|
||||||
Cu.ReportError("win version not found");
|
Cu.reportError("win version not found");
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ var colorTermLogColors = {
|
|||||||
if ("undefined" == typeof(firetray)) {
|
if ("undefined" == typeof(firetray)) {
|
||||||
var firetray = {};
|
var firetray = {};
|
||||||
};
|
};
|
||||||
|
var LogMod;
|
||||||
|
|
||||||
// https://wiki.mozilla.org/Labs/JS_Modules#Logging
|
// https://wiki.mozilla.org/Labs/JS_Modules#Logging
|
||||||
firetray.Logging = {
|
firetray.Logging = {
|
||||||
@ -55,17 +56,22 @@ firetray.Logging = {
|
|||||||
init: function() {
|
init: function() {
|
||||||
if (this.initialized) return;
|
if (this.initialized) return;
|
||||||
|
|
||||||
["resource://services-common/log4moz.js", // FF
|
["resource://gre/modules/Log.jsm", // FF 27+
|
||||||
"resource:///app/modules/gloda/log4moz.js", // TB
|
"resource://services-common/log4moz.js", // FF
|
||||||
"resource://firetray/log4moz.js"] // default
|
"resource:///app/modules/gloda/log4moz.js", // TB
|
||||||
|
"resource://firetray/log4moz.js"] // default
|
||||||
.forEach(function(file){
|
.forEach(function(file){
|
||||||
try {Cu.import(file);} catch(x) {}
|
try {Cu.import(file);} catch(x) {}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if ("undefined" == typeof(Log4Moz)) {
|
if ("undefined" != typeof(Log)) {
|
||||||
let errMsg = "log4moz.js not found";
|
LogMod = Log;
|
||||||
|
} else if ("undefined" != typeof(Log4Moz)) {
|
||||||
|
LogMod = Log4Moz;
|
||||||
|
} else {
|
||||||
|
let errMsg = "Log module not found";
|
||||||
dump(errMsg+"\n");
|
dump(errMsg+"\n");
|
||||||
Cu.ReportError(errMsg);
|
Cu.reportError(errMsg);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setupLogging("firetray");
|
this.setupLogging("firetray");
|
||||||
@ -81,7 +87,7 @@ firetray.Logging = {
|
|||||||
// lifted from log4moz.js
|
// lifted from log4moz.js
|
||||||
function SimpleFormatter() {}
|
function SimpleFormatter() {}
|
||||||
SimpleFormatter.prototype = {
|
SimpleFormatter.prototype = {
|
||||||
__proto__: Log4Moz.Formatter.prototype,
|
__proto__: LogMod.Formatter.prototype,
|
||||||
|
|
||||||
format: function(message) {
|
format: function(message) {
|
||||||
let messageString = "";
|
let messageString = "";
|
||||||
@ -122,14 +128,14 @@ firetray.Logging = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Loggers are hierarchical, affiliation is handled by a '.' in the name.
|
// 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
|
// 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
|
// A console appender outputs to the JS Error Console
|
||||||
let simpleFormatter = new SimpleFormatter();
|
let simpleFormatter = new SimpleFormatter();
|
||||||
let capp = new Log4Moz.ConsoleAppender(simpleFormatter);
|
let capp = new LogMod.ConsoleAppender(simpleFormatter);
|
||||||
capp.level = Log4Moz.Level["Debug"];
|
capp.level = LogMod.Level["Debug"];
|
||||||
this._logger.addAppender(capp);
|
this._logger.addAppender(capp);
|
||||||
|
|
||||||
// A dump appender outputs to standard out
|
// A dump appender outputs to standard out
|
||||||
@ -139,13 +145,13 @@ firetray.Logging = {
|
|||||||
} else {
|
} else {
|
||||||
dumpFormatter = new SimpleFormatter();
|
dumpFormatter = new SimpleFormatter();
|
||||||
}
|
}
|
||||||
let dapp = new Log4Moz.DumpAppender(dumpFormatter);
|
let dapp = new LogMod.DumpAppender(dumpFormatter);
|
||||||
dapp.level = Log4Moz.Level["Debug"];
|
dapp.level = LogMod.Level["Debug"];
|
||||||
this._logger.addAppender(dapp);
|
this._logger.addAppender(dapp);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLogger: function(loggerName){
|
getLogger: function(loggerName){
|
||||||
return Log4Moz.repository.getLogger(loggerName);
|
return LogMod.repository.getLogger(loggerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // firetray.Logging
|
}; // firetray.Logging
|
||||||
|
Loading…
Reference in New Issue
Block a user