mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common: enhancement++ of the logging method
Logging tags are marked with the corresponding log type color, the file and the line information in gray, and the message content in the default color. @Issue: https://github.com/thorvg/thorvg/issues/1351
This commit is contained in:
parent
7bb6713505
commit
0a3718f923
1 changed files with 3 additions and 2 deletions
|
@ -67,9 +67,10 @@ 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 LogColor = "\033[32m"; //green
|
constexpr auto LogColor = "\033[32m"; //green
|
||||||
|
constexpr auto GreyColor = "\033[90m"; //grey
|
||||||
constexpr auto ResetColor = "\033[0m"; //default
|
constexpr auto ResetColor = "\033[0m"; //default
|
||||||
#define TVGERR(tag, fmt, ...) fprintf(stderr, "%s" tag " (%s l.%d): " fmt "%s\n", ErrorColor, __FILE__, __LINE__, ##__VA_ARGS__, ResetColor)
|
#define TVGERR(tag, fmt, ...) fprintf(stderr, "%s" tag "%s (%s l.%d): %s" fmt "\n", ErrorColor, GreyColor, __FILE__, __LINE__, ResetColor, ##__VA_ARGS__)
|
||||||
#define TVGLOG(tag, fmt, ...) fprintf(stderr, "%s" tag " (%s l.%d): " fmt "%s\n", LogColor, __FILE__, __LINE__, ##__VA_ARGS__, ResetColor)
|
#define TVGLOG(tag, fmt, ...) fprintf(stderr, "%s" tag "%s (%s l.%d): %s" fmt "\n", LogColor, GreyColor, __FILE__, __LINE__, ResetColor, ##__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define TVGERR(...)
|
#define TVGERR(...)
|
||||||
#define TVGLOG(...)
|
#define TVGLOG(...)
|
||||||
|
|
Loading…
Add table
Reference in a new issue