Debapriya Biswas
Debapriya Biswas

Reputation: 1349

How do I set the gocqlDebug flag in gocql?

I am using gocql library https://github.com/gocql/gocql for connecting to cassandra. Can you please help me how can I set the gocqlDebug flag to true as I want some debug level logs. gocqlDebug seems to be package private . How do I set it to true?

Upvotes: 3

Views: 129

Answers (2)

Jane He
Jane He

Reputation: 116

Yes, just the build tag go build -tags gocql_debug

You can also customize its behavior by setting cluster.Logger

cluster := gocql.NewCluster("127.0.0.1:9043", "127.0.0.1:9044", "127.0.0.1:9045")
cluster.Logger = log.New(os.Stdout, "gocql: ", log.LstdFlags)

Upvotes: 1

Erick Ramirez
Erick Ramirez

Reputation: 16353

According to debug_on.go, you need to build with the gocql_debug flag:

//go:build gocql_debug
// +build gocql_debug

package gocql

const gocqlDebug = true

I haven't tried it myself but see how you go. Cheers!

Upvotes: 2

Related Questions