๐ŸŽ€ Toy Gemini Client Written in C99
cli retro gemini gemtext terminal tls lightweight minimal c99 gemini-protocol
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(log): coloured logging

Fuwn 4ba10025 47b5504c

+15 -5
+10
include/viv/log.h
··· 6 6 7 7 #pragma once 8 8 9 + #define KNRM "\x1B[0m" 10 + #define KRED "\x1B[31m" 11 + #define KGRN "\x1B[32m" 12 + #define KYEL "\x1B[33m" 13 + #define KBLU "\x1B[34m" 14 + #define KMAG "\x1B[35m" 15 + #define KCYN "\x1B[36m" 16 + #define KWHT "\x1B[37m" 17 + /* #define RESET "\033[0m" */ 18 + 9 19 #define VIV_TRACE(format, ...) VIV_LOG_log(VIV_LOG_level_TRACE, format, __VA_ARGS__); 10 20 #define VIV_DEBUG(format, ...) VIV_LOG_log(VIV_LOG_level_DEBUG, format, __VA_ARGS__); 11 21 #define VIV_INFO(format, ...) VIV_LOG_log(VIV_LOG_level_INFO, format, __VA_ARGS__);
+5 -5
viv/log.c
··· 18 18 19 19 log_file = stdout; 20 20 21 - if (level & VIV_LOG_level_TRACE) { strcpy(log_format, "[trace] "); } 22 - else if (level & VIV_LOG_level_DEBUG) { strcpy(log_format, "[debug] "); } 23 - else if (level & VIV_LOG_level_INFO) { strcpy(log_format, "[info] "); } 21 + if (level & VIV_LOG_level_TRACE) { strcpy(log_format, KMAG "[trace] " KNRM); } 22 + else if (level & VIV_LOG_level_DEBUG) { strcpy(log_format, KCYN "[debug] " KNRM); } 23 + else if (level & VIV_LOG_level_INFO) { strcpy(log_format, KGRN "[info] " KNRM); } 24 24 else if (level & VIV_LOG_level_WARN) { 25 - strcpy(log_format, "[warn] "); 25 + strcpy(log_format, KYEL "[warn] " KNRM); 26 26 log_file = stderr; 27 27 } else if (level & VIV_LOG_level_ERROR) { 28 - strcpy(log_format, "[error] "); 28 + strcpy(log_format, KRED "[error] " KNRM); 29 29 log_file = stderr; 30 30 } 31 31