utulize config log format within gc

Signed-off-by: Tony Holdstock-Brown <tony@docker.com>
This commit is contained in:
Tony Holdstock-Brown 2016-03-24 11:33:01 -07:00
parent 0ef5587b76
commit d52cbf923c
2 changed files with 12 additions and 7 deletions

View file

@ -17,9 +17,7 @@ import (
"github.com/spf13/cobra"
)
func markAndSweep(storageDriver driver.StorageDriver) error {
ctx := context.Background()
func markAndSweep(ctx context.Context, storageDriver driver.StorageDriver) error {
// Construct a registry
registry, err := storage.NewRegistry(ctx, storageDriver)
if err != nil {
@ -141,7 +139,14 @@ var GCCmd = &cobra.Command{
os.Exit(1)
}
err = markAndSweep(driver)
ctx := context.Background()
ctx, err = configureLogging(ctx, config)
if err != nil {
fmt.Fprintf(os.Stderr, "unable to configure logging with config: %s", err)
os.Exit(1)
}
err = markAndSweep(ctx, driver)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to garbage collect: %v", err)
os.Exit(1)