1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 01:03:02 +01:00

Add timestamps to logger and enable widechar for bazel build

This commit is contained in:
jfreegman 2022-03-07 11:26:44 -05:00
parent d113b92baa
commit f07283848f
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,7 @@ cc_binary(
"-std=gnu99", "-std=gnu99",
"-DAUDIO", "-DAUDIO",
"-DGAMES", "-DGAMES",
"-DHAVE_WIDECHAR",
"-DPACKAGE_DATADIR='\"data\"'", "-DPACKAGE_DATADIR='\"data\"'",
"-DPYTHON", "-DPYTHON",
"-DQRCODE", "-DQRCODE",

View File

@ -267,7 +267,12 @@ void cb_toxcore_logger(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t l
fp = stderr; fp = stderr;
} }
fprintf(fp, "[%c] %s:%u(%s) - %s\n", tox_log_level_show(level)[0], file, line, func, message); const time_t t = time(NULL);
struct tm *tmp = gmtime(&t);
char timestamp[200];
strftime(timestamp, sizeof(timestamp), "%F %T", tmp);
fprintf(fp, "[%c] %s %s:%u(%s) - %s\n", tox_log_level_show(level)[0], timestamp, file, line, func, message);
fflush(fp); fflush(fp);
} }