summaryrefslogtreecommitdiff
path: root/toxcore/logger.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-11-24 20:24:59 -0500
committerirungentoo <irungentoo@gmail.com>2014-11-24 20:24:59 -0500
commit279c33c01a9ca721b986aabf72fa982936b20c9e (patch)
tree4c0d289c6d74788989024485d44a4f5c7fec6efc /toxcore/logger.c
parentc67bc3399faae541d64309412326ae92262b1282 (diff)
parent386c9748d48d3bb4513e8e5c32e2b30a4d6a00d4 (diff)
Merge branch 'master' of https://github.com/mannol/toxcore
Diffstat (limited to 'toxcore/logger.c')
-rw-r--r--toxcore/logger.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/toxcore/logger.c b/toxcore/logger.c
index 48a2f303..fe096843 100644
--- a/toxcore/logger.c
+++ b/toxcore/logger.c
@@ -80,7 +80,7 @@ const char *logger_stringify_level(LoggerLevel level)
80 static const char *strings [] = { 80 static const char *strings [] = {
81 "INFO", 81 "INFO",
82 "DEBUG", 82 "DEBUG",
83 "WARNING", 83 "WARN",
84 "ERROR" 84 "ERROR"
85 }; 85 };
86 86
@@ -143,11 +143,26 @@ void logger_write (LoggerLevel level, const char *format, ...)
143 143
144char *logger_timestr(char *dest, size_t max_size) 144char *logger_timestr(char *dest, size_t max_size)
145{ 145{
146 uint64_t diff = (current_time_monotonic() - logger.start_time); /* ms */ 146 time_t timer;
147 snprintf(dest, max_size, "%"PRIu64"", diff); 147 struct tm *tm_info;
148
149 time(&timer);
150 tm_info = localtime(&timer);
151
152 strftime(dest, max_size, "%m:%d %H:%M:%S", tm_info);
148 153
149 return dest; 154 return dest;
155
156 /*uint64_t diff = (current_time_monotonic() - logger.start_time); /* ms * /
157 snprintf(dest, max_size, "%"PRIu64"", diff);
158
159 return dest; */
150} 160}
151 161
162char *logger_posstr (char *dest, size_t max_size, const char *file, int line)
163{
164 snprintf(dest, max_size, "%s:%d", file, line);
165 return dest;
166}
152 167
153#endif /* LOGGING */ 168#endif /* LOGGING */