[MM-54435] Use annotated logger to capture compliance export logs (#24791)

Этот коммит содержится в:
Ben Schumacher
2023-10-23 10:20:32 +02:00
коммит произвёл GitHub
родитель fe6131caed
Коммит d0c22aa1cd
7 изменённых файлов: 35 добавлений и 13 удалений

Просмотреть файл

@@ -6,6 +6,8 @@ package model
import (
"net/http"
"strings"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)
const (
@@ -123,3 +125,17 @@ func (c *Compliance) IsValid() *AppError {
return nil
}
// LoggerFields returns the logger annotations reflecting the given compliance job metadata.
func (c *Compliance) LoggerFields() []mlog.Field {
if c == nil {
return nil
}
return []mlog.Field{
mlog.String("job_id", c.Id),
mlog.String("job_type", c.Type),
mlog.String("job_name", c.JobName()),
mlog.Millis("job_create_at", c.CreateAt),
}
}