f33f7b5c29
+ Refactored all imports + Fixed a bug for the logging regarding removing \n \t \r + Updated to current MGO release + Changed the name of ICCC
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package Log
|
|
|
|
import (
|
|
"github.com/SommerEngineering/Ocean/Log/Meta"
|
|
"time"
|
|
)
|
|
|
|
// Note: The scheduler is the consumer for the logging channel!
|
|
func scheduler(logBuffer chan Meta.Entry) {
|
|
|
|
LogShort(senderName, Meta.CategorySYSTEM, Meta.LevelINFO, Meta.MessageNameSTARTUP, `The scheduler runs now.`)
|
|
var stopNextTime = false
|
|
|
|
for {
|
|
if stopNextTime {
|
|
break
|
|
}
|
|
|
|
nextEntry, ok := <-logBuffer
|
|
|
|
if !ok {
|
|
// The channel was closed!
|
|
stopNextTime = true
|
|
nextEntry = Meta.Entry{}
|
|
nextEntry.Project = projectName
|
|
nextEntry.Time = time.Now().UTC()
|
|
nextEntry.Sender = senderName
|
|
nextEntry.Category = Meta.CategorySYSTEM
|
|
nextEntry.Level = Meta.LevelWARN
|
|
nextEntry.Severity = Meta.SeverityCritical
|
|
nextEntry.Impact = Meta.ImpactNone
|
|
nextEntry.MessageName = Meta.MessageNameCOMMUNICATION
|
|
nextEntry.MessageDescription = `The logging channel was closed!`
|
|
}
|
|
|
|
deviceDelay(nextEntry)
|
|
}
|
|
|
|
LogFull(senderName, Meta.CategorySYSTEM, Meta.LevelWARN, Meta.SeverityCritical, Meta.ImpactNone, Meta.MessageNameSHUTDOWN, `The scheduler is down now.`)
|
|
}
|