зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1657197 - Support enabling MOZ_LOG profilermarkers mirroring at runtime. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D152166
This commit is contained in:
Родитель
a61c54713b
Коммит
8c285223e3
|
@ -378,6 +378,11 @@ function updateLogModules() {
|
|||
activeLogModules.push("sync");
|
||||
}
|
||||
} catch (e) {}
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("logging.config.profilermarkers")) {
|
||||
activeLogModules.push("profilermarkers");
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
let children = Services.prefs.getBranch("logging.").getChildList("");
|
||||
|
||||
|
@ -444,6 +449,8 @@ function setLogModules() {
|
|||
// XXX: append is not yet supported.
|
||||
} else if (module == "sync") {
|
||||
Services.prefs.setBoolPref("logging.config.sync", true);
|
||||
} else if (module == "profilermarkers") {
|
||||
Services.prefs.setBoolPref("logging.config.profilermarkers", true);
|
||||
} else {
|
||||
let lastColon = module.lastIndexOf(":");
|
||||
let key = module.slice(0, lastColon);
|
||||
|
|
|
@ -23,6 +23,7 @@ static const char kLoggingPrefClearOnStartup[] =
|
|||
static const char kLoggingPrefLogFile[] = "logging.config.LOG_FILE";
|
||||
static const char kLoggingPrefAddTimestamp[] = "logging.config.add_timestamp";
|
||||
static const char kLoggingPrefSync[] = "logging.config.sync";
|
||||
static const char kLoggingPrefMarkers[] = "logging.config.profilermarkers";
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -82,6 +83,9 @@ static void LoadPrefValue(const char* aName) {
|
|||
} else if (prefName.EqualsLiteral(kLoggingPrefSync)) {
|
||||
bool sync = Preferences::GetBool(aName, false);
|
||||
LogModule::SetIsSync(sync);
|
||||
} else if (prefName.EqualsLiteral(kLoggingPrefMarkers)) {
|
||||
bool enableMarkers = Preferences::GetBool(aName, false);
|
||||
LogModule::SetRecordMarkers(enableMarkers);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -520,6 +520,8 @@ class LogModuleManager {
|
|||
|
||||
void SetIsSync(bool aIsSync) { mIsSync = aIsSync; }
|
||||
|
||||
void SetRecordMarkers(bool aRecordMarkers) { mAddProfilerMarker = aRecordMarkers; }
|
||||
|
||||
void SetAddTimestamp(bool aAddTimestamp) { mAddTimestamp = aAddTimestamp; }
|
||||
|
||||
detail::LogFile* OpenFile(bool aShouldAppend, uint32_t aFileNum,
|
||||
|
@ -812,6 +814,10 @@ void LogModule::SetIsSync(bool aIsSync) {
|
|||
sLogModuleManager->SetIsSync(aIsSync);
|
||||
}
|
||||
|
||||
void LogModule::SetRecordMarkers(bool aRecordMarkers) {
|
||||
sLogModuleManager->SetRecordMarkers(aRecordMarkers);
|
||||
}
|
||||
|
||||
// This function is defined in gecko_logger/src/lib.rs
|
||||
// We mirror the level in rust code so we don't get forwarded all of the
|
||||
// rust logging and have to create an LogModule for each rust component.
|
||||
|
|
|
@ -119,6 +119,12 @@ class LogModule {
|
|||
*/
|
||||
static void SetIsSync(bool aIsSync);
|
||||
|
||||
/**
|
||||
* @param aRecordMarkers If we should add Firefox Profiler markers for each
|
||||
* log entry.
|
||||
*/
|
||||
static void SetRecordMarkers(bool aRecordMarkers);
|
||||
|
||||
/**
|
||||
* Indicates whether or not the given log level is enabled.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче