This is an automated email from the ASF dual-hosted git repository.

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new f999d84  feat : show version information when the program started 
(#238)
f999d84 is described below

commit f999d84d17485b3e19b82e678d204824020b36c3
Author: tbone <[email protected]>
AuthorDate: Sat Feb 6 13:30:49 2021 +0800

    feat : show version information when the program started (#238)
    
    related issue: #228 .
---
 cmd/ingress/ingress.go      | 3 +++
 cmd/ingress/ingress_test.go | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/cmd/ingress/ingress.go b/cmd/ingress/ingress.go
index 21ca78b..096f58d 100644
--- a/cmd/ingress/ingress.go
+++ b/cmd/ingress/ingress.go
@@ -28,6 +28,7 @@ import (
        "github.com/apache/apisix-ingress-controller/pkg/config"
        "github.com/apache/apisix-ingress-controller/pkg/ingress/controller"
        "github.com/apache/apisix-ingress-controller/pkg/log"
+       "github.com/apache/apisix-ingress-controller/pkg/version"
 )
 
 func dief(template string, args ...interface{}) {
@@ -96,6 +97,8 @@ the apisix cluster and others are created`,
                        log.DefaultLogger = logger
                        log.Info("apisix ingress controller started")
 
+                       log.Info("version:\n", version.Long())
+
                        data, err := json.MarshalIndent(cfg, "", "\t")
                        if err != nil {
                                dief("failed to show configuration: %s", 
string(data))
diff --git a/cmd/ingress/ingress_test.go b/cmd/ingress/ingress_test.go
index a6b307d..80ebabb 100644
--- a/cmd/ingress/ingress_test.go
+++ b/cmd/ingress/ingress_test.go
@@ -138,6 +138,10 @@ func TestNewIngressCommandEffectiveLog(t *testing.T) {
        assert.Equal(t, f.Level, "info")
 
        f = parseLog(t, buf)
+       assert.Contains(t, f.Message, "version:")
+       assert.Equal(t, f.Level, "info")
+
+       f = parseLog(t, buf)
        assert.Contains(t, f.Message, "use configuration")
        assert.Equal(t, f.Level, "info")
 

Reply via email to