MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / logHelper

Function logHelper

common/logger.go:72–91  ·  view source on GitHub ↗
(ctx context.Context, level string, msg string)

Source from the content-addressed store, hash-verified

70}
71
72func logHelper(ctx context.Context, level string, msg string) {
73 writer := gin.DefaultErrorWriter
74 if level == loggerINFO {
75 writer = gin.DefaultWriter
76 }
77 id := ctx.Value(RequestIdKey)
78 if id == nil {
79 id = "SYSTEM"
80 }
81 now := time.Now()
82 _, _ = fmt.Fprintf(writer, "[%s] %v | %s | %s \n", level, now.Format("2006/01/02 - 15:04:05"), id, msg)
83 logCount++ // we don't need accurate count, so no lock here
84 if logCount > maxLogCount && !setupLogWorking {
85 logCount = 0
86 setupLogWorking = true
87 gopool.Go(func() {
88 SetupLogger()
89 })
90 }
91}
92
93func FatalLog(v ...any) {
94 t := time.Now()

Callers 3

LogInfoFunction · 0.85
LogWarnFunction · 0.85
LogErrorFunction · 0.85

Calls 2

SetupLoggerFunction · 0.85
ValueMethod · 0.45

Tested by

no test coverage detected