From cbd191dd7b4595a0ec7bbbe3f2f3b24920f8cd2b Mon Sep 17 00:00:00 2001 From: Rokett Date: Mon, 14 Sep 2020 18:39:33 +0100 Subject: [PATCH] Ensuring correct bind port is reflected in logging --- CHANGELOG.md | 4 ++++ Dockerfile | 2 +- Makefile | 2 +- main.go | 8 +++----- make.bat | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e8f255..8a1ca67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [4.5.1] - 2020-09-14 +### Fixed + - #43 Ensuring that the logging reflects a custom bind port. Previously the logging was being setup in `init` which was before the flags are parsed. + ## [4.5.0] - 2020-07-25 ### Added - #41 Added the following AAA metrics. diff --git a/Dockerfile b/Dockerfile index 0bf3f52..ecaac4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:alpine as builder -ENV VERSION="4.4.0" +ENV VERSION="4.5.1" WORKDIR $GOPATH/src/github.com/rokett RUN \ diff --git a/Makefile b/Makefile index 42f77d7..431f5f1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: build APP = Citrix-NetScaler-Exporter -VERSION = 4.5.0 +VERSION = 4.5.1 BINARY-LINUX = ${APP}_${VERSION}_Linux_amd64 BUILD_VER = $(shell git rev-parse HEAD) diff --git a/main.go b/main.go index db321f6..92c0ff7 100644 --- a/main.go +++ b/main.go @@ -31,11 +31,6 @@ var ( nsInstance string ) -func init() { - logger = log.NewLogfmtLogger(os.Stdout) - logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller, "app", app, "bind_port", *bindPort, "version", "v"+version, "build", build) -} - func main() { flag.Parse() @@ -49,6 +44,9 @@ func main() { os.Exit(1) } + logger = log.NewLogfmtLogger(os.Stdout) + logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller, "app", app, "bind_port", *bindPort, "version", "v"+version, "build", build) + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(` Citrix NetScaler Exporter diff --git a/make.bat b/make.bat index 2979dca..334b5b4 100644 --- a/make.bat +++ b/make.bat @@ -2,7 +2,7 @@ SETLOCAL set APP=Citrix-NetScaler-Exporter -set VERSION=4.5.0 +set VERSION=4.5.1 set BINARY-WINDOWS-X64=%APP%_%VERSION%_Windows_amd64.exe set BINARY-LINUX=%APP%_%VERSION%_Linux_amd64