1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

Flush the stdout buffer after logging to console

Normally if the stdout is connected to a PTY, the stdout buffer is flushed automatically after each \n.
However if I run SRS under Docker, the stdout is not connected to a PTY (unless I ask it to), causing the last log line to be incomplete (showing only half).
By adding fflush, we could make sure each log line is completely shown, whenever the stdout is connected to a PTY or not.
This commit is contained in:
Star Brilliant 2016-09-08 07:58:52 -05:00 committed by GitHub
parent 7aaa74b9e0
commit a164c90e28

View file

@ -382,6 +382,7 @@ void SrsFastLog::write_log(int& fd, char *str_log, int size, int level)
} else{
printf("\033[31m%.*s\033[0m", size, str_log);
}
fflush(stdout);
return;
}