summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index e751e9e4..8960fe36 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -44,6 +44,7 @@ void id_cpy(uint8_t *dest, uint8_t *src)
44} 44}
45 45
46#ifdef LOGGING 46#ifdef LOGGING
47time_t starttime = 0;
47char logbuffer[512]; 48char logbuffer[512];
48static FILE *logfile = NULL; 49static FILE *logfile = NULL;
49void loginit(uint16_t port) 50void loginit(uint16_t port)
@@ -53,10 +54,12 @@ void loginit(uint16_t port)
53 54
54 sprintf(logbuffer, "%u-%u.log", ntohs(port), now()); 55 sprintf(logbuffer, "%u-%u.log", ntohs(port), now());
55 logfile = fopen(logbuffer, "w"); 56 logfile = fopen(logbuffer, "w");
57 starttime = now();
56}; 58};
57void loglog(char *text) 59void loglog(char *text)
58{ 60{
59 if (logfile) { 61 if (logfile) {
62 fprintf(logfile, "%4u ", now() - starttime);
60 fprintf(logfile, text); 63 fprintf(logfile, text);
61 fflush(logfile); 64 fflush(logfile);
62 } 65 }