Bug 989137 - Part 5: Prefix each log message with the instance of the object; r=gfritzsche

We now maintain per-type counts/IDs of each Policy, Experiments, and
ExperimentEntry. The log events for each type are prefixed with the
count/ID so one can easily attribute events to specific instances.

--HG--
extra : rebase_source : 4f1fcc38e5f52ff38b90f9ce71e332492983ff37
This commit is contained in:
Gregory Szorc 2014-03-28 13:04:09 -07:00
parent 6990849710
commit e2999a404f

View File

@ -95,6 +95,9 @@ const gPrefsTelemetry = new Preferences(PREF_BRANCH_TELEMETRY);
let gExperimentsEnabled = false;
let gExperiments = null;
let gLogAppenderDump = null;
let gPolicyCounter = 0;
let gExperimentsCounter = 0;
let gExperimentEntryCounter = 0;
let gLogger;
let gLogDumping = false;
@ -237,7 +240,8 @@ let Experiments = {
Experiments.Policy = function () {
this._log = Log.repository.getLoggerWithMessagePrefix(
"Browser.Experiments.Policy", "Experiments::Policy::");
"Browser.Experiments.Policy",
"Policy #" + gPolicyCounter++ + "::");
};
Experiments.Policy.prototype = {
@ -304,7 +308,8 @@ Experiments.Policy.prototype = {
Experiments.Experiments = function (policy=new Experiments.Policy()) {
this._log = Log.repository.getLoggerWithMessagePrefix(
"Browser.Experiments.Experiments", "Experiments::");
"Browser.Experiments.Experiments",
"Experiments #" + gExperimentsCounter++ + "::");
this._policy = policy;
@ -1015,7 +1020,8 @@ Experiments.Experiments.prototype = {
Experiments.ExperimentEntry = function (policy) {
this._policy = policy || new Experiments.Policy();
this._log = Log.repository.getLoggerWithMessagePrefix(
"Browser.Experiments.Experiments", "ExperimentEntry::");
"Browser.Experiments.Experiments",
"ExperimentEntry #" + gExperimentEntryCounter++ + "::");
// Is this experiment running?
this._enabled = false;