diff options
Diffstat (limited to 'logging.h')
| -rw-r--r-- | logging.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/logging.h b/logging.h index 6ad5729..0e676dd 100644 --- a/logging.h +++ b/logging.h @@ -1,12 +1,20 @@ #include <stdarg.h> #include <unistd.h> +#include <time.h> static void aura_printf(const char *fmt, ...) { + char timestr[20] = { 0 }; va_list args = { 0 }; + struct tm *m = { 0 }; + time_t stamp = 0; - printf("[%d] ", getpid()); + stamp = time(NULL); + m = localtime(&stamp); + strftime((char *)×tr, 20, "%G-%m-%d %H:%M:%S", m); + + printf("{%s} [%d] ", (char *)×tr, getpid()); va_start(args, fmt); vprintf(fmt, args); va_end(args); |
