Support log extras
Reviewed By: javache Differential Revision: D2580869 fb-gh-sync-id: bd24c976aef09243cd11b408d0f37997e400d238
This commit is contained in:
parent
725de1d236
commit
f87d2e15bd
|
@ -14,6 +14,7 @@
|
|||
var performanceNow = require('performanceNow');
|
||||
|
||||
var timespans = {};
|
||||
var extras = {};
|
||||
|
||||
/**
|
||||
* This is meant to collect and log performance data in production, which means
|
||||
|
@ -72,6 +73,7 @@ var PerformanceLogger = {
|
|||
|
||||
clearTimespans() {
|
||||
timespans = {};
|
||||
extras = {};
|
||||
},
|
||||
|
||||
getTimespans() {
|
||||
|
@ -99,6 +101,23 @@ var PerformanceLogger = {
|
|||
label
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
setExtra(key, value) {
|
||||
if (extras[key]) {
|
||||
if (__DEV__) {
|
||||
console.log(
|
||||
'PerformanceLogger: Attempting to set an extra that already exists ',
|
||||
key
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
extras[key] = value;
|
||||
},
|
||||
|
||||
getExtras() {
|
||||
return extras;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue