diff options
-rw-r--r-- | 003trace.cc | 8 | ||||
-rw-r--r-- | 020run.cc | 2 | ||||
-rw-r--r-- | 081run_interactive.cc | 1 |
3 files changed, 7 insertions, 4 deletions
diff --git a/003trace.cc b/003trace.cc index d7b78668..11bad7a2 100644 --- a/003trace.cc +++ b/003trace.cc @@ -103,14 +103,17 @@ struct trace_stream { string curr_layer; int curr_depth; string dump_layer; + string collect_layer; // if set, ignore all other layers + ofstream null_stream; // never opens a file, so writes silently fail trace_stream() :curr_stream(NULL), curr_depth(0) {} ~trace_stream() { if (curr_stream) delete curr_stream; } - ostringstream& stream(string layer) { + ostream& stream(string layer) { return stream(0, layer); } - ostringstream& stream(int depth, string layer) { + ostream& stream(int depth, string layer) { + if (!collect_layer.empty() && layer != collect_layer) return null_stream; newline(); curr_stream = new ostringstream; curr_layer = layer; @@ -154,7 +157,6 @@ trace_stream* Trace_stream = NULL; // Top-level helper. IMPORTANT: can't nest. #define trace(...) !Trace_stream ? cerr /*print nothing*/ : Trace_stream->stream(__VA_ARGS__) -//? #define trace(...) true ? cerr /*print nothing*/ : Trace_stream->stream(__VA_ARGS__) // Warnings should go straight to cerr by default since calls to trace() have // some unfriendly constraints (they delay printing, they can't nest) #define raise ((!Trace_stream || !Hide_warnings) ? (tb_shutdown(),cerr) /*do print*/ : Trace_stream->stream("warn")) diff --git a/020run.cc b/020run.cc index 60a5c116..5969a27d 100644 --- a/020run.cc +++ b/020run.cc @@ -129,7 +129,7 @@ if (argc > 1) { if (!Run_tests) { setup(); //? Trace_file = "interactive"; //? 1 - START_TRACING_UNTIL_END_OF_SCOPE; +//? START_TRACING_UNTIL_END_OF_SCOPE; //? Trace_stream->dump_layer = "all"; //? 2 transform_all(); recipe_ordinal r = Recipe_ordinal[string("main")]; diff --git a/081run_interactive.cc b/081run_interactive.cc index 3f68a514..bd5a6496 100644 --- a/081run_interactive.cc +++ b/081run_interactive.cc @@ -56,6 +56,7 @@ bool run_interactive(long long int address) { if (!Trace_stream) { Trace_file = ""; // if there wasn't already a stream we don't want to save it Trace_stream = new trace_stream; + Trace_stream->collect_layer = "warn"; } // call run(string) but without the scheduling load("recipe interactive [\n"+command+"\n]\n"); |