From a267205d545be9b80d94e32de4477ba155872392 Mon Sep 17 00:00:00 2001 From: Thulasiraj Komminar <39799163+thulasirajkomminar@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:36:01 +0200 Subject: [PATCH 1/2] feat: added logging --- CHANGELOG.md | 1 + influxdb3/config.go | 3 ++- influxdb3/point_values.go | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13b9e6d..39d5d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Others 1. [#68](https://github.com/InfluxCommunity/influxdb3-go/pull/68): Upgrade Go version to 1.22. +2. [#74](https://github.com/InfluxCommunity/influxdb3-go/pull/74): Added logger. ## 0.6.0 [2024-03-01] diff --git a/influxdb3/config.go b/influxdb3/config.go index 8943ae4..78a6aaf 100644 --- a/influxdb3/config.go +++ b/influxdb3/config.go @@ -25,11 +25,12 @@ package influxdb3 import ( "errors" "fmt" - "github.com/influxdata/line-protocol/v2/lineprotocol" "net/http" "net/url" "os" "strconv" + + "github.com/influxdata/line-protocol/v2/lineprotocol" ) const ( diff --git a/influxdb3/point_values.go b/influxdb3/point_values.go index 60aedae..a7099cd 100644 --- a/influxdb3/point_values.go +++ b/influxdb3/point_values.go @@ -24,6 +24,7 @@ package influxdb3 import ( "fmt" + "log/slog" "time" ) @@ -70,7 +71,7 @@ func (pv *PointValues) SetTimestamp(timestamp time.Time) *PointValues { // SetTag sets a tag value and returns the modified PointValues func (pv *PointValues) SetTag(name string, value string) *PointValues { if value == "" { - fmt.Printf("Empty tags has no effect, tag [%s], measurement [%s]\n", name, pv.MeasurementName) + slog.Debug(fmt.Sprintf("Empty tags has no effect, tag [%s], measurement [%s]", name, pv.MeasurementName)) } else { pv.Tags[name] = value } From bad20af523139e67218c7442f93a618e7abdf303 Mon Sep 17 00:00:00 2001 From: Thulasiraj Komminar <39799163+thulasirajkomminar@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:39:58 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub Bednář --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39d5d22..e8a05ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### Others 1. [#68](https://github.com/InfluxCommunity/influxdb3-go/pull/68): Upgrade Go version to 1.22. -2. [#74](https://github.com/InfluxCommunity/influxdb3-go/pull/74): Added logger. +2. [#74](https://github.com/InfluxCommunity/influxdb3-go/pull/74): Use `log/slog` to print debug information instead of `fmt.Printf` ## 0.6.0 [2024-03-01]