This is an automated email from the ASF dual-hosted git repository.
joaoreis pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-gocql-driver.git
The following commit(s) were added to refs/heads/trunk by this push:
new ba7d563 Remove global logger
ba7d563 is described below
commit ba7d5634e98df911989d0f219cd3d1cdff279a83
Author: tengu-alt <[email protected]>
AuthorDate: Wed Nov 20 13:33:02 2024 +0200
Remove global logger
By default, if the logger in the cluster config is not set,
the NewSession() method sets a default logger instance
which is a deprecated global variable.
patch by Oleksandr Luzhniy; reviewed by João Reis, Stanislav Bychkov,
Jackson Fleming, for CASSGO-24
---
CHANGELOG.md | 2 ++
cluster.go | 4 ++--
conn.go | 2 +-
logger.go | 4 ----
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 67c88a1..197a891 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,8 @@ and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0
- Change Batch API to be consistent with Query() (CASSGO-7)
+- Remove deprecated global logger (CASSGO-24)
+
### Fixed
- Retry policy now takes into account query idempotency (CASSGO-27)
diff --git a/cluster.go b/cluster.go
index 413695c..1b96940 100644
--- a/cluster.go
+++ b/cluster.go
@@ -260,7 +260,7 @@ type ClusterConfig struct {
HostDialer HostDialer
// Logger for this ClusterConfig.
- // If not specified, defaults to the global gocql.Logger.
+ // If not specified, defaults to the gocql.defaultLogger.
Logger StdLogger
// internal config for testing
@@ -304,7 +304,7 @@ func NewCluster(hosts ...string) *ClusterConfig {
func (cfg *ClusterConfig) logger() StdLogger {
if cfg.Logger == nil {
- return Logger
+ return &defaultLogger{}
}
return cfg.Logger
}
diff --git a/conn.go b/conn.go
index ae02bd7..22b2cd7 100644
--- a/conn.go
+++ b/conn.go
@@ -151,7 +151,7 @@ type ConnConfig struct {
func (c *ConnConfig) logger() StdLogger {
if c.Logger == nil {
- return Logger
+ return &defaultLogger{}
}
return c.Logger
}
diff --git a/logger.go b/logger.go
index 246a117..1520111 100644
--- a/logger.go
+++ b/logger.go
@@ -58,7 +58,3 @@ type defaultLogger struct{}
func (l *defaultLogger) Print(v ...interface{}) {
log.Print(v...) }
func (l *defaultLogger) Printf(format string, v ...interface{}) {
log.Printf(format, v...) }
func (l *defaultLogger) Println(v ...interface{}) {
log.Println(v...) }
-
-// Logger for logging messages.
-// Deprecated: Use ClusterConfig.Logger instead.
-var Logger StdLogger = &defaultLogger{}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]