[FIX] remove empty logger message

This commit is contained in:
goodrain 2018-03-08 16:04:24 +08:00
parent a9a16f82d7
commit 8a3bcfa3af
2 changed files with 10 additions and 6 deletions

View File

@ -275,8 +275,10 @@ func createProgress(ctx context.Context, logger event.Logger) sideband.Progress
if len(line) > 0 {
progess := strings.Replace(string(line), "\r", "", -1)
progess = strings.Replace(progess, "\n", "", -1)
message := fmt.Sprintf(`{"progress":"%s","id":"%s"}`, progess, "获取源码:")
logger.Debug(message, map[string]string{"step": "progress"})
if len(progess) > 0 {
message := fmt.Sprintf(`{"progress":"%s","id":"%s"}`, progess, "获取源码")
logger.Debug(message, map[string]string{"step": "progress"})
}
}
}
}

View File

@ -219,10 +219,12 @@ func ImageBuild(dockerCli *client.Client, contextDir string, options types.Image
message := strings.Replace(string(line), "\n", "", -1)
message = strings.Replace(message, "\r", "", -1)
message = strings.Replace(message, "\u003e", ">", -1)
if logger != nil {
logger.Debug(message, map[string]string{"step": "build-progress"})
} else {
fmt.Println(message)
if len(message) > 0 {
if logger != nil {
logger.Debug(message, map[string]string{"step": "build-progress"})
} else {
fmt.Println(message)
}
}
}
} else {