added colon to WRITE_FORMAT flag

and implemented it => that flag is used for getting length of log prefix so yeah you get it

hehe
This commit is contained in:
Václav Šmejkal 2023-01-24 11:55:42 +01:00
parent 914e7a2020
commit f2a62fdb7b
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59
2 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ const enum RETURN_CODES //exit codes you fucking idiot (2#)
#define LOG_FORMATTING "%s/%s_%03x.log" //SAME THING AS LOG_FORMAT, BUT USED IN sprintf IN logger.c, NOT AS LENGTH
#define LOG_FORMATTING_START "%04d-%02d-%02d" //FIRST PART OF LOG_FORMATTING
#define WRITE_FORMAT "[hh:mm:ss] " //LOG MESSAGE'S PREFIX (THE SPACE AT THE END IS INTENTIONAL)
#define WRITE_FORMAT "[hh:mm:ss]: " //LOG MESSAGE'S PREFIX (THE SPACE AT THE END IS INTENTIONAL)
#define WRITE_FORMATTING "[%02d:%02d:%02d]: %s\n" //guess what
#define LOG_LATEST_FORMATTING "%s/%s"

View File

@ -139,7 +139,7 @@ void writeLog(int loggerFile, char *logMessage)
message = logMessageUsed;
}
buffer = malloc(strlen(WRITE_FORMAT) + strlen(message) + 3); //ALLOCATE
buffer = malloc(strlen(WRITE_FORMAT) + strlen(message) + 2); //ALLOCATE
sprintf(buffer, WRITE_FORMATTING, tm.tm_hour, tm.tm_min, tm.tm_sec, message); //LOAD MESSAGE