mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common: adding [E]/[L] markers to errors/logs (#1365)
common: adding [E]/[L] markers to errors/logs @Issue: https://github.com/thorvg/thorvg/issues/1351
This commit is contained in:
parent
0a3718f923
commit
4f3b718c3f
1 changed files with 5 additions and 3 deletions
|
@ -66,11 +66,13 @@ enum class FileType { Tvg = 0, Svg, Raw, Png, Jpg, Unknown };
|
||||||
|
|
||||||
#ifdef THORVG_LOG_ENABLED
|
#ifdef THORVG_LOG_ENABLED
|
||||||
constexpr auto ErrorColor = "\033[31m"; //red
|
constexpr auto ErrorColor = "\033[31m"; //red
|
||||||
|
constexpr auto ErrorBgColor = "\033[41m";//bg red
|
||||||
constexpr auto LogColor = "\033[32m"; //green
|
constexpr auto LogColor = "\033[32m"; //green
|
||||||
|
constexpr auto LogBgColor = "\033[42m"; //bg green
|
||||||
constexpr auto GreyColor = "\033[90m"; //grey
|
constexpr auto GreyColor = "\033[90m"; //grey
|
||||||
constexpr auto ResetColor = "\033[0m"; //default
|
constexpr auto ResetColors = "\033[0m"; //default
|
||||||
#define TVGERR(tag, fmt, ...) fprintf(stderr, "%s" tag "%s (%s l.%d): %s" fmt "\n", ErrorColor, GreyColor, __FILE__, __LINE__, ResetColor, ##__VA_ARGS__)
|
#define TVGERR(tag, fmt, ...) fprintf(stderr, "%s[E]%s %s" tag "%s (%s l.%d): %s" fmt "\n", ErrorBgColor, ResetColors, ErrorColor, GreyColor, __FILE__, __LINE__, ResetColors, ##__VA_ARGS__)
|
||||||
#define TVGLOG(tag, fmt, ...) fprintf(stderr, "%s" tag "%s (%s l.%d): %s" fmt "\n", LogColor, GreyColor, __FILE__, __LINE__, ResetColor, ##__VA_ARGS__)
|
#define TVGLOG(tag, fmt, ...) fprintf(stderr, "%s[L]%s %s" tag "%s (%s l.%d): %s" fmt "\n", LogBgColor, ResetColors, LogColor, GreyColor, __FILE__, __LINE__, ResetColors, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define TVGERR(...)
|
#define TVGERR(...)
|
||||||
#define TVGLOG(...)
|
#define TVGLOG(...)
|
||||||
|
|
Loading…
Add table
Reference in a new issue