main v1.0.8
alex 2023-10-08 12:57:19 +02:00
parent 725aba339f
commit 8c150add43
1 changed files with 1 additions and 16 deletions

View File

@ -2,7 +2,6 @@ package rslogger
import ( import (
"encoding/json" "encoding/json"
"fmt"
"os" "os"
"time" "time"
@ -31,24 +30,10 @@ func InitLogger(debug bool, colorizedOutput bool, logManagerServerUrl string) {
} }
} }
func getTime() string { func GetTime() string {
return time.Now().Format("15:04:05 02-01-2006") + " " return time.Now().Format("15:04:05 02-01-2006") + " "
} }
func AddSystemLog(format string, v ...any) {
log.Info().Msgf("used log manager server url: %s", usedLogManagerServerUrl)
go LogManagerRequestClient(fiber.MethodPost, usedLogManagerServerUrl+"/v1/log", LogManagerRequestBody{
Type: "system",
Logs: []string{"I " + getTime() + fmt.Sprintf(format, v...)}})
}
func AddGroupTasksLog(format string, v ...any) {
go LogManagerRequestClient(fiber.MethodPost, usedLogManagerServerUrl+"/v1/log", LogManagerRequestBody{
Type: "grouptasks",
Logs: []string{"I " + getTime() + fmt.Sprintf(format, v...)}})
}
type LogManagerRequestBody struct { type LogManagerRequestBody struct {
Type string Type string
Logs []string Logs []string