summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/coverage/control.py b/coverage/control.py
index fde6f63b..050b6fbd 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -201,9 +201,15 @@ class Coverage(object):
if self._inited:
return
- # Create and configure the debugging controller.
+ # Create and configure the debugging controller. COVERAGE_DEBUG_FILE
+ # is an environment variable, the name of a file to append debug logs
+ # to.
if self._debug_file is None:
- self._debug_file = sys.stderr
+ debug_file_name = os.environ.get("COVERAGE_DEBUG_FILE")
+ if debug_file_name:
+ self._debug_file = open(debug_file_name, "a")
+ else:
+ self._debug_file = sys.stderr
self.debug = DebugControl(self.config.debug, self._debug_file)
# Load plugins