Ocean/Log/Flush.go
Thorsten 3348e552cc Misc.
+ Removed the fixed shutdown time
+ Added the configuration for the public web server
+ Refactored the old web server settings
+ Improved the handling of shutdown handlers. It is not save!
+ Bugfix: The server start was no longer blocking
2014-11-07 13:00:55 +01:00

31 lines
740 B
Go

package Log
import (
"github.com/SommerEngineering/Ocean/Log/Device"
)
/*
Please do not call this function your self! This function allows Ocean to flush the logging at the shutting down case.
*/
func Flush() {
mutexChannel.Lock()
channelReady = false
close(entriesBuffer)
mutexChannel.Unlock()
<-schedulerExitSignal
mutexDeviceDelays.Lock()
dataArray := logEntryListToArray(deviceDelayBuffer)
deviceDelayBuffer.Init()
mutexDeviceDelays.Unlock()
mutexDevices.RLock()
for entry := devices.Front(); entry != nil; entry = entry.Next() {
dev := entry.Value.(Device.Device)
dev.Log(dataArray) // Want to wait to complete, therefore no new thread here
dev.Flush()
}
mutexDevices.RUnlock()
}