Explorer: Add heading and sub-heading methods to trace (#3088)

Instead of manually putting symbols before and after heading, this
introduces two methods `Heading` and `SubHeading` inside `TraceStream`.

Both methods take `llvm::StringRef` as parameter, formats the given text
as follows and adds it into the output stream.

**Heading**
```
* * * * * * * * * *  heading  * * * * * * * * * *
-------------------------------------------------
```
**Sub heading**
```
- - - - -  sub heading  - - - - -
---------------------------------
```

Note: both methods assert that tracing should be enabled.
This commit is contained in:
Prabhat Sachdeva
2023-08-10 22:40:21 +00:00
committed by GitHub
parent 7b22173cba
commit 2a74c807d8
15 changed files with 99 additions and 48 deletions
@@ -78,7 +78,7 @@ auto ParseAndExecute(llvm::vfs::FileSystem& fs, std::string_view prelude_path,
auto print_trace_timing_heading = llvm::make_scope_exit([=]() {
SetProgramPhase set_prog_phase(*trace_stream, ProgramPhase::Timing);
if (trace_stream->is_enabled()) {
*trace_stream << "********** printing timing **********\n";
trace_stream->Heading("printing timing");
}
});