Skip to content

Commit

Permalink
fix: masking token for logging (influxdata#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlastahajek committed Mar 7, 2022
1 parent 5368398 commit b9a194a
Showing 1 changed file with 7 additions and 1 deletion.
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 b9a194a

Please sign in to comment.