MCPcopy
hub / github.com/containers/toolbox / showEntryPointLog

Function showEntryPointLog

src/cmd/run.go:924–967  ·  view source on GitHub ↗
(line string)

Source from the content-addressed store, hash-verified

922}
923
924func showEntryPointLog(line string) error {
925 var logLevel logrus.Level
926 var logLevelFound bool
927 var logMsg string
928
929 reader := strings.NewReader(line)
930 decoder := logfmt.NewDecoder(reader)
931
932 if decoder.ScanRecord() {
933 for decoder.ScanKeyval() {
934 value := decoder.Value()
935 valueString := string(value)
936
937 switch key := decoder.Key(); string(key) {
938 case "level":
939 logLevelFound = true
940
941 var err error
942 logLevel, err = logrus.ParseLevel(valueString)
943 if err != nil {
944 logrus.Debugf("Parsing entry point log-level %s failed: %s",
945 valueString,
946 err)
947 logLevel = logrus.DebugLevel
948 }
949 case "msg":
950 logMsg = valueString
951 }
952 }
953 }
954
955 if err := decoder.Err(); err != nil {
956 return err
957 }
958
959 if !logLevelFound {
960 errMsg, _ := strings.CutPrefix(line, "Error: ")
961 return &entryPointError{errMsg}
962 }
963
964 logger := logrus.StandardLogger()
965 logger.Logf(logLevel, "> %s", logMsg)
966 return nil
967}
968
969func showEntryPointLogs(container string, since time.Time) error {
970 var stderr strings.Builder

Callers 2

handleEntryPointLogFunction · 0.85
showEntryPointLogsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…