MCPcopy
hub / github.com/cortexlabs/cortex / GetRealtimeAPILogger

Function GetRealtimeAPILogger

pkg/operator/operator/logging.go:104–122  ·  view source on GitHub ↗
(apiName string, apiID string)

Source from the content-addressed store, hash-verified

102}
103
104func GetRealtimeAPILogger(apiName string, apiID string) (*zap.SugaredLogger, error) {
105 loggerCacheKey := fmt.Sprintf("apiName=%s,apiID=%s", apiName, apiID)
106 logger := getFromCacheOrNil(loggerCacheKey)
107
108 if logger != nil {
109 return logger, nil
110 }
111
112 apiSpec, err := DownloadAPISpec(apiName, apiID)
113 if err != nil {
114 return nil, err
115 }
116
117 return initializeLogger(loggerCacheKey, userconfig.InfoLogLevel, map[string]interface{}{
118 "apiName": apiSpec.Name,
119 "apiKind": apiSpec.Kind.String(),
120 "apiID": apiSpec.ID,
121 })
122}
123
124func GetRealtimeAPILoggerFromSpec(apiSpec *spec.API) (*zap.SugaredLogger, error) {
125 loggerCacheKey := fmt.Sprintf("apiName=%s,apiID=%s", apiSpec.Name, apiSpec.ID)

Callers

nothing calls this directly

Calls 4

getFromCacheOrNilFunction · 0.85
DownloadAPISpecFunction · 0.85
initializeLoggerFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected