Skip to content

Commit

Permalink
Merge pull request #315 from bonitoo-io/fix/debug_log
Browse files Browse the repository at this point in the history
fix: masking token for logging
  • Loading branch information
vlastahajek authored Mar 8, 2022
2 parents 5368398 + 6aedde3 commit fbae8a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## unreleased
### Bug fixes
- [#315](https://github.com/influxdata/influxdb-client-go/pull/315) Masking authorization token in log
-
## 2.8.0 [2022-02-18]
### Features
- [#304](https://github.com/influxdata/influxdb-client-go/pull/304) Added public constructor for `QueryTableResult`
Expand Down
8 changes: 7 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ func NewClientWithOptions(serverURL string, authToken string, options *Options)
if log.Log != nil {
log.Log.SetLogLevel(options.LogLevel())
}
ilog.Infof("Using URL '%s', token '%s'", serverURL, authToken)
if ilog.Level() >= log.InfoLevel {
tokenStr := ""
if len(authToken) > 0 {
tokenStr = ", token '******'"
}
ilog.Infof("Using URL '%s'%s", serverURL, tokenStr)
}
return client
}
func (c *clientImpl) Options() *Options {
Expand Down

0 comments on commit fbae8a3

Please sign in to comment.