Improving Makefile

Change-Id: I7460ef36b2492e2715e312c19e034c6c83b505ea
diff --git a/Makefile b/Makefile
index 7ca1f34..ced4e17 100644
--- a/Makefile
+++ b/Makefile
@@ -12,17 +12,31 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-REGISTRY          ?=
-REPOSITORY        ?=
-DOCKER_BUILD_ARGS ?=
-TAG               ?= $(shell cat ${MAKEFILE_DIR}/VERSION)
-IMAGENAME         := ${REGISTRY}${REPOSITORY}sadis-server:${TAG}
-SHELL             := /bin/bash
+# Variables
+VERSION                  ?= $(shell cat ./VERSION)
+SERVICE_NAME             ?= sadis-server
 
-all: build push
+## Docker related
+DOCKER_REGISTRY          ?=
+DOCKER_REPOSITORY        ?=
+DOCKER_BUILD_ARGS        ?=
+DOCKER_TAG               ?= ${VERSION}
+DOCKER_IMAGENAME         := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}${SERVICE_NAME}:${DOCKER_TAG}
 
-build:
-	docker build $(DOCKER_BUILD_ARGS) -t ${IMAGENAME} -f Dockerfile .
+all: test
 
-push:
-	docker push ${IMAGENAME}
\ No newline at end of file
+docker-build:
+	docker build $(DOCKER_BUILD_ARGS) \
+	-t ${DOCKER_IMAGENAME} \
+	--build-arg org_label_schema_version="${VERSION}" \
+	--build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \
+	--build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \
+	--build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \
+	--build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
+	-f Dockerfile .
+
+docker-push:
+	docker push ${DOCKER_IMAGENAME}
+
+test:
+	go test -v ./...
diff --git a/handlers.go b/handlers.go
index 0950ca7..eb8b8fc 100644
--- a/handlers.go
+++ b/handlers.go
@@ -144,7 +144,7 @@
 			} else {
 				ipaddr = addr.String()
 			}
-			log.Debugf("ID: %s, Uplink: %s, IPAddress: %s, NasID: %s", devID, toInt(device.Uplink), ipaddr, device.NasID)
+			log.Debugf("ID: %s, Uplink: %d, IPAddress: %s, NasID: %s", devID, toInt(device.Uplink), ipaddr, device.NasID)
 			sadisDevice := sadisDevice{
 				ID:         devID,
 				Uplink:     toInt(device.Uplink),
diff --git a/sadisServer.go b/sadisServer.go
index fcb1cf4..99bdd11 100644
--- a/sadisServer.go
+++ b/sadisServer.go
@@ -33,7 +33,7 @@
 	Xos         string `default:"127.0.0.1:8181" desc:"connection string with which to connect to XOS"`
 	Username    string `default:"admin@opencord.org" desc:"username with which to connect to XOS"`
 	Password    string `default:"letmein" desc:"password with which to connect to XOS"`
-	LogLevel    string `default:"info" envconfig:"LOG_LEVEL" desc:"detail level for logging"`
+	LogLevel    string `default:"debug" envconfig:"LOG_LEVEL" desc:"detail level for logging"`
 	LogFormat   string `default:"text" envconfig:"LOG_FORMAT" desc:"log output format, text or json"`
 	KafkaBroker string `default:"" desc:"url of the kafka broker"`