mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
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:
parent
d2036d7c98
commit
aa23f17657
@ -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;
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user