File tree 1 file changed +33
-1
lines changed
1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,30 @@ getLevel(unsigned level) noexcept
240
240
}
241
241
}
242
242
243
+ constexpr
244
+ llvm::raw_ostream::Colors
245
+ getLevelColor (Level level)
246
+ {
247
+ switch (level)
248
+ {
249
+ case Level::trace:
250
+ return llvm::raw_ostream::Colors::CYAN;
251
+ case Level::debug:
252
+ return llvm::raw_ostream::Colors::GREEN;
253
+ case Level::info:
254
+ return llvm::raw_ostream::Colors::WHITE;
255
+ case Level::warn:
256
+ return llvm::raw_ostream::Colors::MAGENTA;
257
+ case Level::error:
258
+ return llvm::raw_ostream::Colors::RED;
259
+ case Level::fatal:
260
+ return llvm::raw_ostream::Colors::RED;
261
+ default :
262
+ MRDOCS_UNREACHABLE ();
263
+ }
264
+ }
265
+
266
+
243
267
void
244
268
call_impl (
245
269
Level level,
@@ -282,7 +306,15 @@ call_impl(
282
306
std::lock_guard<llvm::sys::Mutex> lock (mutex_);
283
307
if (!s.empty())
284
308
{
285
- llvm::errs () << s;
309
+ if (level >= Level::error)
310
+ {
311
+ llvm::errs () << s;
312
+ }
313
+ else
314
+ {
315
+ llvm::outs () << getLevelColor (level) << s << llvm::raw_ostream::Colors::RESET;
316
+ llvm::outs ().flush ();
317
+ }
286
318
}
287
319
switch (level)
288
320
{
You can’t perform that action at this time.
0 commit comments