Skip to content

Commit

Permalink
Add timestamps to logger and enable widechar for bazel build
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Mar 18, 2022
1 parent 631b1d8 commit 529d905
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions BUILD.bazel
Expand Up @@ -21,6 +21,7 @@ cc_binary(
"-std=gnu99",
"-DAUDIO",
"-DGAMES",
"-DHAVE_WIDECHAR",
"-DPACKAGE_DATADIR='\"data\"'",
"-DPYTHON",
"-DQRCODE",
Expand Down
7 changes: 6 additions & 1 deletion src/toxic.c
Expand Up @@ -267,7 +267,12 @@ void cb_toxcore_logger(Tox *m, TOX_LOG_LEVEL level, const char *file, uint32_t l
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);
}

Expand Down

0 comments on commit 529d905

Please sign in to comment.