Extract log utils into pkg/log

Docker-DCO-1.1-Signed-off-by: Josiah Kiehl <josiah@capoferro.net> (github: capoferro)
This commit is contained in:
Josiah Kiehl
2014-07-24 13:37:44 -07:00
committed by Erik Hollensbe
parent 13eb477b62
commit a02f67be5b
44 changed files with 465 additions and 346 deletions

View File

@@ -23,6 +23,7 @@ import (
"github.com/docker/docker/archive"
"github.com/docker/docker/engine"
"github.com/docker/docker/nat"
"github.com/docker/docker/pkg/log"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/symlink"
"github.com/docker/docker/pkg/system"
@@ -262,11 +263,11 @@ func (b *buildFile) probeCache() (bool, error) {
return false, err
} else if cache != nil {
fmt.Fprintf(b.outStream, " ---> Using cache\n")
utils.Debugf("[BUILDER] Use cached version")
log.Debugf("[BUILDER] Use cached version")
b.image = cache.ID
return true, nil
} else {
utils.Debugf("[BUILDER] Cache miss")
log.Debugf("[BUILDER] Cache miss")
}
}
return false, nil
@@ -288,7 +289,7 @@ func (b *buildFile) CmdRun(args string) error {
defer func(cmd []string) { b.config.Cmd = cmd }(cmd)
utils.Debugf("Command to be executed: %v", b.config.Cmd)
log.Debugf("Command to be executed: %v", b.config.Cmd)
hit, err := b.probeCache()
if err != nil {
@@ -378,7 +379,7 @@ func (b *buildFile) CmdEnv(args string) error {
func (b *buildFile) buildCmdFromJson(args string) []string {
var cmd []string
if err := json.Unmarshal([]byte(args), &cmd); err != nil {
utils.Debugf("Error unmarshalling: %s, setting to /bin/sh -c", err)
log.Debugf("Error unmarshalling: %s, setting to /bin/sh -c", err)
cmd = []string{"/bin/sh", "-c", args}
}
return cmd
@@ -551,7 +552,7 @@ func (b *buildFile) addContext(container *Container, orig, dest string, decompre
if err := archive.UntarPath(origPath, tarDest); err == nil {
return nil
} else if err != io.EOF {
utils.Debugf("Couldn't untar %s to %s: %s", origPath, tarDest, err)
log.Debugf("Couldn't untar %s to %s: %s", origPath, tarDest, err)
}
}