From 009e1f2b15c8de452c5c245d99640859a458e86c Mon Sep 17 00:00:00 2001 From: Soikk Date: Sun, 26 Oct 2025 16:43:55 +0100 Subject: Fixed logging bug and added padding to PID field --- log/log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'log/log.c') diff --git a/log/log.c b/log/log.c index 74db0eb..74ee010 100755 --- a/log/log.c +++ b/log/log.c @@ -149,7 +149,8 @@ void log_message(int level, char *file, int line, char *fmt, ...){ char msg[MSG_LIMIT] = {0}; int written = snprintf(msg, MSG_LIMIT-2, #ifdef PID - "[%d] " + // the maximum PID is a 5 digit number. this shoud be customizable + "[%-5d] " #endif "%s%s%s%s%s%s%s\t", #ifdef PID @@ -173,8 +174,10 @@ void log_message(int level, char *file, int line, char *fmt, ...){ msg[written] = '\n'; if(log_levels[level].stder) fputs(msg, stderr); for(int i = 0; i < log_levels[level].nfps; i++){ - if(log_levels[level].fps[i] != NULL) + if(log_levels[level].fps[i] != NULL){ fputs(msg, log_levels[level].fps[i]); + fflush(log_levels[level].fps[i]); + } } } } -- cgit v1.2.3