3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-23 03:02:48 +01:00

logger: Flush file writes to ensure they get written out

This commit is contained in:
Daniel Oaks 2017-05-01 19:02:49 +10:00
parent 7ac96114c3
commit f5ecf70ecf

View File

@ -242,6 +242,7 @@ func (logger *singleLogger) Log(level Level, logType string, messageParts ...str
if logger.MethodFile.Enabled { if logger.MethodFile.Enabled {
logger.fileWriteLock.Lock() logger.fileWriteLock.Lock()
logger.MethodFile.Writer.WriteString(fullStringRaw + "\n") logger.MethodFile.Writer.WriteString(fullStringRaw + "\n")
logger.MethodFile.Writer.Flush()
logger.fileWriteLock.Unlock() logger.fileWriteLock.Unlock()
} }
} }