Bug 1053836 - Fix subclassing of prefix loggers by only overriding the log() method, not all the other methods. This fixes this resolution in the Experiment log override, r=gps

--HG--
extra : rebase_source : fd81dc1a5aa15b4b1e57413991a787a463b42945
This commit is contained in:
Benjamin Smedberg 2014-08-14 16:30:54 -04:00
parent d2036d7c98
commit aa23f17657

View File

@ -497,19 +497,8 @@ LoggerRepository.prototype = {
getLoggerWithMessagePrefix: function (name, prefix) {
let log = this.getLogger(name);
let proxy = {__proto__: log};
for (let level in Log.Level) {
if (level == "Desc") {
continue;
}
let lc = level.toLowerCase();
proxy[lc] = function (msg, ...args) {
return log[lc].apply(log, [prefix + msg, ...args]);
};
}
let proxy = Object.create(log);
proxy.log = (level, string, params) => log.log(level, prefix + string, params);
return proxy;
},
};