BT_ASSERT(): update rendering
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 12 Apr 2019 21:15:38 +0000 (17:15 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:39 +0000 (18:19 -0400)
* Move flip-table emoji at the beginning.
* Make flip-table emoji compatible with terminals which do not support
  combining diacritics.
* Colorize file name, line number, and function name independently.
* Add `()` after function name.
* Make the whole "Assertion `...` failed." red, but the message itself
  bold.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
common/assert.c

index d02e911312cc028d2c00a0822ece8d1c2e3649d3..ebc987697a8bdbb4c9608953b4b4cf691230bdbc 100644 (file)
@@ -28,9 +28,28 @@ void bt_common_assert_failed(
        bt_common_color_bold();
        bt_common_color_fg_red();
        fprintf(stderr,
-               "%s%s:%d: %s: Assertion %s`%s`%s failed. (╯ ͡°  □ ͡°)╯︵ ┻━┻%s\n",
-               bt_common_color_bold(), file, line, func,
-               bt_common_color_fg_red(), assertion,
-               bt_common_color_fg_default(), bt_common_color_reset());
+               "%s\n%s%s%s (╯°□°)╯︵ ┻━┻ %s %s%s%s%s:%s%d%s: %s%s()%s: "
+               "%sAssertion %s`%s`%s%s failed.%s\n",
+               bt_common_color_reset(),
+               bt_common_color_bold(),
+               bt_common_color_bg_yellow(),
+               bt_common_color_fg_red(),
+               bt_common_color_reset(),
+               bt_common_color_bold(),
+               bt_common_color_fg_magenta(),
+               file,
+               bt_common_color_reset(),
+               bt_common_color_fg_green(),
+               line,
+               bt_common_color_reset(),
+               bt_common_color_fg_cyan(),
+               func,
+               bt_common_color_reset(),
+               bt_common_color_fg_red(),
+               bt_common_color_bold(),
+               assertion,
+               bt_common_color_reset(),
+               bt_common_color_fg_red(),
+               bt_common_color_reset());
        abort();
-}
\ No newline at end of file
+}
This page took 0.025148 seconds and 4 git commands to generate.