Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aebcb615a5 | ||
|
|
7901e2ebee |
No files matched your search
@@ -1,15 +0,0 @@
|
|||||||
package SystemMessages
|
|
||||||
|
|
||||||
// The message to send logging events over ICCC.
|
|
||||||
type ICCCNewLogEvent struct {
|
|
||||||
Project string
|
|
||||||
UnixTimestampUTC int64
|
|
||||||
Sender string
|
|
||||||
Category string
|
|
||||||
Level string
|
|
||||||
Severity string
|
|
||||||
Impact string
|
|
||||||
MessageName string
|
|
||||||
MessageDescription string
|
|
||||||
Parameters []string
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,6 @@ const (
|
|||||||
ChannelSTARTUP string = `System::Startup` // A channel for system startup messages.
|
ChannelSTARTUP string = `System::Startup` // A channel for system startup messages.
|
||||||
ChannelICCC string = `System::ICCC` // A common ICCC channel.
|
ChannelICCC string = `System::ICCC` // A common ICCC channel.
|
||||||
ChannelPING string = `System::Ping` // A channel for pings.
|
ChannelPING string = `System::Ping` // A channel for pings.
|
||||||
ChannelLOGGING string = `System::Logging` // A channel for send log events to the logging system
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
package ICCCLog
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/SommerEngineering/Ocean/ICCC"
|
|
||||||
"github.com/SommerEngineering/Ocean/ICCC/SystemMessages"
|
|
||||||
"github.com/SommerEngineering/Ocean/Log"
|
|
||||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// The receiver function for the ICCC new log event message.
|
|
||||||
func ICCCNewLogEventReceiver(data map[string][]string) (result map[string][]string) {
|
|
||||||
|
|
||||||
// Recover from errors:
|
|
||||||
defer func() {
|
|
||||||
if err := recover(); err != nil {
|
|
||||||
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityUnknown, LM.ImpactUnknown, LM.MessageNamePARSE, "Was not able to execute the ICCC new log event message.")
|
|
||||||
result = make(map[string][]string, 0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Converts the HTTP form data into an object:
|
|
||||||
_, _, obj := ICCC.Data2Message(SystemMessages.ICCCNewLogEvent{}, data)
|
|
||||||
|
|
||||||
// Was it possible to convert the data?
|
|
||||||
if obj != nil {
|
|
||||||
// Cast the object to the right type:
|
|
||||||
messageData := obj.(SystemMessages.ICCCNewLogEvent)
|
|
||||||
|
|
||||||
// Provide a log entry:
|
|
||||||
logEntry := LM.Entry{}
|
|
||||||
logEntry.Sender = LM.Sender(messageData.Sender)
|
|
||||||
logEntry.Category = LM.ParseCategory(messageData.Category)
|
|
||||||
logEntry.Level = LM.ParseLevel(messageData.Level)
|
|
||||||
logEntry.Severity = LM.ParseSeverity(messageData.Severity)
|
|
||||||
logEntry.Impact = LM.ParseImpact(messageData.Impact)
|
|
||||||
logEntry.MessageName = LM.MessageName(messageData.MessageName)
|
|
||||||
logEntry.MessageDescription = messageData.MessageDescription
|
|
||||||
logEntry.Parameters = messageData.Parameters
|
|
||||||
logEntry.Time = time.Unix(messageData.UnixTimestampUTC, 0).UTC()
|
|
||||||
|
|
||||||
// Deliver the log event:
|
|
||||||
Log.TakeEntry(logEntry)
|
|
||||||
|
|
||||||
// An answer is necessary:
|
|
||||||
return ICCC.Message2Data("", "", SystemMessages.AnswerACK)
|
|
||||||
} else {
|
|
||||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `ICCC message: Was not able to create the message.`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// In any other error case:
|
|
||||||
result = make(map[string][]string, 0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package ICCCLog
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/SommerEngineering/Ocean/Log/Meta"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
senderName Meta.Sender = `System::Log::ICCCLog`
|
|
||||||
)
|
|
||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"github.com/SommerEngineering/Ocean/CustomerDB"
|
"github.com/SommerEngineering/Ocean/CustomerDB"
|
||||||
"github.com/SommerEngineering/Ocean/ICCC"
|
"github.com/SommerEngineering/Ocean/ICCC"
|
||||||
"github.com/SommerEngineering/Ocean/Log"
|
"github.com/SommerEngineering/Ocean/Log"
|
||||||
"github.com/SommerEngineering/Ocean/Log/ICCCLog"
|
|
||||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||||
"github.com/SommerEngineering/Ocean/NumGen"
|
"github.com/SommerEngineering/Ocean/NumGen"
|
||||||
"github.com/SommerEngineering/Ocean/Shutdown"
|
"github.com/SommerEngineering/Ocean/Shutdown"
|
||||||
@@ -110,7 +109,6 @@ func initSystem() {
|
|||||||
ICCC.Registrar(ICCC.ChannelICCC, `ICCC::GetHosts`, ICCC.ICCCGetHostsReceiver)
|
ICCC.Registrar(ICCC.ChannelICCC, `ICCC::GetHosts`, ICCC.ICCCGetHostsReceiver)
|
||||||
ICCC.Registrar(ICCC.ChannelICCC, `ICCC::GetListeners`, ICCC.ICCCGetListenersReceiver)
|
ICCC.Registrar(ICCC.ChannelICCC, `ICCC::GetListeners`, ICCC.ICCCGetListenersReceiver)
|
||||||
ICCC.Registrar(ICCC.ChannelNUMGEN, `NumGen::Next`, NumGen.ICCCNextNumberReceiver)
|
ICCC.Registrar(ICCC.ChannelNUMGEN, `NumGen::Next`, NumGen.ICCCNextNumberReceiver)
|
||||||
ICCC.Registrar(ICCC.ChannelLOGGING, `Logging::NewLogEvent`, ICCCLog.ICCCNewLogEventReceiver)
|
|
||||||
|
|
||||||
// Start the ICCC Listener Cache:
|
// Start the ICCC Listener Cache:
|
||||||
ICCC.InitCacheNow() // Blocking, until the job is done
|
ICCC.InitCacheNow() // Blocking, until the job is done
|
||||||
|
|||||||
Reference in new issue
Block a user