Closed bpowers closed 9 years ago
Hi Bobby,
I agree that sometimes it is convenient to output to a file. But it is also useful to print out those colored lines in the debugging phases. I suggest whether we can use a macro to control this. I really want to keep those colored lines.
Thanks!
Tongping Liu Assistant Professor CS, University of Texas at San Antonio http://www.cs.utsa.edu/~tongpingliu/
On Fri, Sep 11, 2015 at 4:39 PM, Bobby Powers notifications@github.com wrote:
Two goals here: support selecting the log-level at runtime (not yet implemented) without incurring much additional overhead, and simplify some of the code.
What we're left with is a macro that checks a global atomic corresponding to the current DoubleTake log-level against the log-level of the statement (is it a WARNING, INFO, or DEBUG message), calling into an out-of-line vararg logf function w/ the current file + line info if we should emit something.
Runtime log-level setting via an environmental variable is something that will be done as a followup - I think it goes hand in hand with being able to disable colorized output, to support piping output to a
file or non-terminal.
You can view, comment on, or merge this pull request online at:
https://github.com/plasma-umass/DoubleTake/pull/23 Commit Summary
- log: cleanup & move much into source/log.cpp
File Changes
- M include/log.hh https://github.com/plasma-umass/DoubleTake/pull/23/files#diff-0 (121)
- M include/xdefines.hh https://github.com/plasma-umass/DoubleTake/pull/23/files#diff-1 (3)
- A source/log.cpp https://github.com/plasma-umass/DoubleTake/pull/23/files#diff-2 (100)
- M source/xrun.cpp https://github.com/plasma-umass/DoubleTake/pull/23/files#diff-3 (2)
Patch Links:
- https://github.com/plasma-umass/DoubleTake/pull/23.patch
- https://github.com/plasma-umass/DoubleTake/pull/23.diff
— Reply to this email directly or view it on GitHub https://github.com/plasma-umass/DoubleTake/pull/23.
Hi Tongping!
I agree, and just to be clear, this PR does not remove any colorization. In my testing before and after this change, the output remains the same, with the same colors. I just wanted to bring up that in the future it would be nice to be able to redirect the output of DoubleTake to a file, without having the file full of shell control characters.
yours, Bobby
Two goals here: support selecting the log-level at runtime (not yet implemented) without incurring much additional overhead, and simplify some of the code.
What we're left with is a macro that checks a global atomic corresponding to the current DoubleTake log-level against the log-level of the statement (is it a WARNING, INFO, or DEBUG message), calling into an out-of-line vararg logf function w/ the current file + line info if we should emit something.
Runtime log-level setting via an environmental variable is something that will be done as a followup - I think it goes hand in hand with being able to disable colorized output, to support piping output to a file or non-terminal.