From 5a787fba9df3f2cee8827f2843a4fc3c0490b80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ximo=20Cuadros?= Date: Fri, 2 Oct 2015 13:17:36 +0200 Subject: [PATCH] makefile: removing version from dir on packages --- Makefile | 8 ++++---- middlewares/logger.go | 13 +++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 319e422bf..5080a998a 100644 --- a/Makefile +++ b/Makefile @@ -54,14 +54,14 @@ packages: dependencies for os in $(PKG_OS); do \ for arch in $(PKG_ARCH); do \ cd $(BASE_PATH); \ - mkdir -p $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}; \ + mkdir -p $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}; \ for cmd in $(COMMANDS); do \ - GOOS=$${os} GOARCH=$${arch} $(GOCMD) build -ldflags "-X main.version $(BRANCH) -X main.build \"$(BUILD)\"" -o $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}/$${cmd} $${cmd}.go ; \ + GOOS=$${os} GOARCH=$${arch} $(GOCMD) build -ldflags "-X main.version $(BRANCH) -X main.build \"$(BUILD)\"" -o $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}/$${cmd} $${cmd}.go ; \ done; \ for content in $(PKG_CONTENT); do \ - cp -rf $${content} $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}/; \ + cp -rf $${content} $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}/; \ done; \ - cd $(BUILD_PATH) && tar -cvzf $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}.tar.gz $(PROJECT)_$(BRANCH)_$${os}_$${arch}/; \ + cd $(BUILD_PATH) && tar -cvzf $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}.tar.gz $(PROJECT)_$${os}_$${arch}/; \ done; \ done; diff --git a/middlewares/logger.go b/middlewares/logger.go index ce0ae4ab1..d039f2bd4 100644 --- a/middlewares/logger.go +++ b/middlewares/logger.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/mcuadros/ofelia/core" - "github.com/prometheus/log" "github.com/op/go-logging" ) @@ -21,7 +20,7 @@ func (m *Logger) Run(ctx *core.Context) error { e := ctx.Execution j := ctx.Job - log.Info(fmt.Sprintf( + m.logger.Debug(fmt.Sprintf( "%s - Job started %q - %s", j.GetName(), e.ID, j.GetCommand(), )) @@ -34,10 +33,16 @@ func (m *Logger) Run(ctx *core.Context) error { errText = ctx.Execution.Error.Error() } - log.Info(fmt.Sprintf( + msg := fmt.Sprintf( "%s - Job finished %q in %s, failed: %t, error: %s", j.GetName(), e.ID, e.Duration, e.Failed, errText, - )) + ) + + if ctx.Execution.Error != nil { + m.logger.Warning(msg) + } else { + m.logger.Notice(msg) + } return err }