added log types

main v1.0.15
alex 2023-10-17 22:02:19 +02:00
parent 9ba51167b8
commit e3534a9068
1 changed files with 10 additions and 4 deletions

View File

@ -35,11 +35,17 @@ func GetTime() string {
}
type LogManagerRequestBody struct {
Type string
Logs []string
Type string // like system, grouptasks, etc
Logs []string // array of logs
}
func LogManagerRequestClient(requestMethod string, body interface{}) {
const (
LogTypeInfo = "I"
LogTypeWarning = "W"
LogTypeError = "E"
)
func LogManagerRequestClient(requestMethod string, requestBody LogManagerRequestBody) {
if usedLogManagerServerUrl == "" {
log.Error().Msgf("Log manager server url is not set, skipping request")
return
@ -52,7 +58,7 @@ func LogManagerRequestClient(requestMethod string, body interface{}) {
req.SetRequestURI(usedLogManagerServerUrl + "/v1/log")
req.Header.SetContentType("application/json")
reqestBodyBytes, err := json.Marshal(body)
reqestBodyBytes, err := json.Marshal(requestBody)
if err != nil {
log.Error().Msgf("Failed to marshal request body, err: %s", err)