diff options
| author | Soikk | 2025-10-26 16:43:55 +0100 |
|---|---|---|
| committer | Soikk | 2025-10-26 16:43:55 +0100 |
| commit | 009e1f2b15c8de452c5c245d99640859a458e86c (patch) | |
| tree | bb1b3bd6ea27eebe46e79bfed23838631443de2c /log/log.c | |
| parent | b62b7ab69a5f68fc40633c2828ba0eea04bccda2 (diff) | |
| download | soikk-libs-009e1f2b15c8de452c5c245d99640859a458e86c.tar.xz soikk-libs-009e1f2b15c8de452c5c245d99640859a458e86c.tar.zst | |
Fixed logging bug and added padding to PID field
Diffstat (limited to 'log/log.c')
| -rwxr-xr-x | log/log.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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]); + } } } } |
