diff options
| author | rubin <rubinowyblask@meow.li> | 2026-05-22 16:26:30 +0200 |
|---|---|---|
| committer | rubin <rubinowyblask@meow.li> | 2026-05-22 16:26:30 +0200 |
| commit | 8323c2b2d6e7cbcc6ccc7f4c2eb4b3ff37c8c8c5 (patch) | |
| tree | c3cc21585967b12860a70da9bf4be7d4dd6f3455 /logging.h | |
| parent | 89abeab564abac85e0cd33e8e6333193cb9cbe9f (diff) | |
prepend time with aura_printf
Signed-off-by: rubin <rubinowyblask@meow.li>
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); |
