mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Enable line buffering of log
Replace flushing/writing of log at every log write operation with line buffering, meaning log will be written line by line to make it more I/O friendly but still update frequently.
This commit is contained in:
parent
d28007f0d3
commit
a13fe254f2
1 changed files with 2 additions and 4 deletions
|
|
@ -76,8 +76,8 @@ void log_open(const char *filename)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Enable full buffering
|
||||
setvbuf(fp, file_buffer, _IOFBF, BUFSIZ);
|
||||
// Enable line buffering
|
||||
setvbuf(fp, file_buffer, _IOLBF, BUFSIZ);
|
||||
}
|
||||
|
||||
bool log_strip(char c)
|
||||
|
|
@ -149,7 +149,6 @@ void log_printf(const char *format, ...)
|
|||
va_end(args);
|
||||
|
||||
fwrite(line, strlen(line), 1, fp);
|
||||
fflush(fp);
|
||||
|
||||
free(line);
|
||||
}
|
||||
|
|
@ -170,7 +169,6 @@ void log_putc(char c)
|
|||
fputc(c, fp);
|
||||
}
|
||||
}
|
||||
fflush(fp);
|
||||
}
|
||||
|
||||
void log_close(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue