added some *working* code into writeLog's body
This commit is contained in:
parent
6074e06e9f
commit
0f4492a611
@ -56,5 +56,15 @@ int initLogger(char *directoryPath)
|
||||
|
||||
void writeLog(int loggerFile, char *logMessage)
|
||||
{
|
||||
write(loggerFile, logMessage, strlen(logMessage));
|
||||
//VARIABLES
|
||||
char *buffer = malloc(strlen(WRITE_FORMAT) + strlen(logMessage) + 1);
|
||||
time_t timeL = time(NULL);
|
||||
struct tm tm = *localtime(&timeL);
|
||||
|
||||
sprintf(buffer, WRITE_FORMATTING, tm.tm_hour, tm.tm_min, tm.tm_sec, logMessage); //LOAD MESSAGE
|
||||
|
||||
write(loggerFile, buffer, strlen(buffer)); //WRITE (YAY)
|
||||
|
||||
//DEALLOCATION
|
||||
free(buffer);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user