Bug 1248565 - Switch debugging to MOZ_LOG. r?erahm
This is shorter than MOZ_LOG_MODULES and equally clear.
Add a deprecation warning to encourge folks to migrate,
and update references in the test runner.
MozReview-Commit-ID: HYY3Q9tSu13
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -78,21 +78,23 @@ except ImportError:
here = os.path.abspath(os.path.dirname(__file__))
########################################
# Option for MOZ (former NSPR) logging #
########################################
-# Set the desired log modules you want a log be produced by a try run for, or leave blank to disable the feature.
-# This will be passed to MOZ_LOG_MODULES environment variable. Try run will then put a download link for all log files
+# Set the desired log modules you want a log be produced
+# by a try run for, or leave blank to disable the feature.
+# This will be passed to MOZ_LOG environment variable.
+# Try run will then put a download link for all log files
# on tbpl.mozilla.org.
-MOZ_LOG_MODULES = ""
+MOZ_LOG = ""
#####################
# Test log handling #
#####################
# output processing
@@ -1229,21 +1231,21 @@ toolbar#nav-bar {
browserEnv["MOZ_GMP_PATH"] = gmp_path
except EnvironmentError:
self.log.error('Could not find path to gmp-fake plugin!')
return None
if options.fatalAssertions:
browserEnv["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
- # Produce a mozlog, if setup (see MOZ_LOG_MODULES global at the top of
+ # Produce a mozlog, if setup (see MOZ_LOG global at the top of
# this script).
- self.mozLogs = MOZ_LOG_MODULES and "MOZ_UPLOAD_DIR" in os.environ
+ self.mozLogs = MOZ_LOG and "MOZ_UPLOAD_DIR" in os.environ
if self.mozLogs:
- browserEnv["MOZ_LOG_MODULES"] = MOZ_LOG_MODULES
+ browserEnv["MOZ_LOG"] = MOZ_LOG
if debugger and not options.slowscript:
browserEnv["JS_DISABLE_SLOW_SCRIPT_SIGNALS"] = "1"
# For e10s, our tests default to suppressing the "unsafe CPOW usage"
# warnings that can plague test logs.
if not options.enableCPOWWarnings:
browserEnv["DISABLE_UNSAFE_CPOW_WARNINGS"] = "1"
--- a/xpcom/base/Logging.cpp
+++ b/xpcom/base/Logging.cpp
@@ -117,19 +117,30 @@ public:
/**
* Loads config from env vars if present.
*/
void Init()
{
bool shouldAppend = false;
bool addTimestamp = false;
bool isSync = false;
- const char* modules = PR_GetEnv("MOZ_LOG_MODULES");
+ const char* modules = PR_GetEnv("MOZ_LOG");
+ if (!modules || !modules[0]) {
+ modules = PR_GetEnv("MOZ_LOG_MODULES");
+ if (modules) {
+ NS_WARNING("MOZ_LOG_MODULES is deprecated."
+ "\nPlease use MOZ_LOG instead.");
+ }
+ }
if (!modules || !modules[0]) {
modules = PR_GetEnv("NSPR_LOG_MODULES");
+ if (modules) {
+ NS_WARNING("NSPR_LOG_MODULES is deprecated."
+ "\nPlease use MOZ_LOG instead.");
+ }
}
NSPRLogModulesParser(modules,
[&shouldAppend, &addTimestamp, &isSync]
(const char* aName, LogLevel aLevel) mutable {
if (strcmp(aName, "append") == 0) {
shouldAppend = true;
} else if (strcmp(aName, "timestamp") == 0) {