core: component -> task

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-11-24 16:58:24 -08:00
parent ef407c787a
commit 81ec746d2c
6 changed files with 12 additions and 12 deletions

View File

@@ -118,7 +118,7 @@ func formatMessage(event map[string]interface{}) string {
func parseSource(event map[string]interface{}) string {
source := "system"
if task, ok := event["component"].(string); ok && task != "" {
if task, ok := event["task"].(string); ok && task != "" {
source = task
}
return source
@@ -141,7 +141,7 @@ func formatFields(entry map[string]interface{}) string {
zerolog.ErrorFieldName: {},
zerolog.CallerFieldName: {},
"environment": {},
"component": {},
"task": {},
"state": {},
}

View File

@@ -43,7 +43,7 @@ func (l *Logs) Add(event Event) error {
l.l.Lock()
defer l.l.Unlock()
component, ok := event["component"].(string)
task, ok := event["task"].(string)
if !ok {
l.Messages = append(l.Messages, Message{
Event: event,
@@ -52,7 +52,7 @@ func (l *Logs) Add(event Event) error {
return nil
}
groupKey := strings.Split(component, ".#up")[0]
groupKey := strings.Split(task, ".#up")[0]
group := l.groups[groupKey]
// If the group doesn't exist, create it
@@ -72,8 +72,8 @@ func (l *Logs) Add(event Event) error {
// For state events, we just want to update the group status -- no need to
// dispanything
if st, ok := event["state"].(string); ok {
// Ignore state updates for "sub" components
if component != groupKey {
// Ignore state updates for "sub" tasks
if task != groupKey {
return nil
}