Skip to content

Commit e9594f0

Browse files
committed
chore: change to message to warning
1 parent 4efa483 commit e9594f0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
## [unreleased]
22
### Features
33
- [#358](https://github.com/influxdata/influxdb-client-go/pull/358):
4-
- Added possibility to set an application name, which will be part of the User-Agent HTTP header
4+
- Added possibility to set an application name, which will be part of the User-Agent HTTP header:
55
- Set using `Options.SetApplicationName`
6-
- Error message is written to log if an application name is not set.
6+
- Warning message is written to log if an application name is not set
7+
- This may change to be logged as an error in a future release
78
- Added example how to fully override `User-Agent` header using `Doer` interface
89

910
### Bug fixes

client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func NewClientWithOptions(serverURL string, authToken string, options *Options)
146146
ilog.Infof("Using URL '%s'%s", serverURL, tokenStr)
147147
}
148148
if options.ApplicationName() == "" {
149-
ilog.Error("Application name is not set")
149+
ilog.Warn("Application name is not set")
150150
}
151151
return client
152152
}

client_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package influxdb2
77
import (
88
"context"
99
"fmt"
10+
ilog "github.com/influxdata/influxdb-client-go/v2/log"
1011
"log"
1112
"net/http"
1213
"net/http/httptest"
@@ -111,7 +112,7 @@ func TestUserAgent(t *testing.T) {
111112
var sb strings.Builder
112113
log.SetOutput(&sb)
113114
log.SetFlags(0)
114-
c := NewClient(server.URL, "x")
115+
c := NewClientWithOptions(server.URL, "x", DefaultOptions().SetLogLevel(ilog.WarningLevel))
115116
assert.True(t, strings.Contains(sb.String(), "Application name is not set"))
116117
up, err := c.Ping(context.Background())
117118
require.NoError(t, err)

0 commit comments

Comments
 (0)