diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-24 07:50:25 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-24 07:50:25 -0400 |
commit | f7e159775d3d854d2fe512287fdb02c072bedcb4 (patch) | |
tree | 83538da976050443ff5b4cca73dafb477b8f5c2a /coverage/debug.py | |
parent | 44049333cb1c2550fe5a5e9d54d57c5c3589ee3b (diff) | |
download | python-coveragepy-f7e159775d3d854d2fe512287fdb02c072bedcb4.tar.gz |
Don't print a call stack for each line in multi-line debug output
Diffstat (limited to 'coverage/debug.py')
-rw-r--r-- | coverage/debug.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/coverage/debug.py b/coverage/debug.py index 96e5792..823d2b2 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -37,8 +37,14 @@ class DebugControl(object): """Decide whether to output debug information in category `option`.""" return (option in self.options or option in FORCED_DEBUG) - def write(self, msg): - """Write a line of debug output.""" + def write(self, msg, callers=True): + """Write a line of debug output. + + `msg` is the line to write. A newline will be appended. If `callers` + is true, and the user has requested it, the call stack will be written + also. + + """ if self.should('pid'): msg = "pid %5d: %s" % (os.getpid(), msg) self.output.write(msg+"\n") @@ -50,7 +56,7 @@ class DebugControl(object): """Write a sequence of (label,data) pairs nicely.""" self.write(info_header(header)) for line in info_formatter(info): - self.write(" %s" % line) + self.write(" %s" % line, callers=False) def info_header(label): |