Skip to content
Webinar - May 13th: How Criteo powers real-time decisions with a reduced footprintRegister now

Logging

Use the Aerospike Go client logging interface for debugging and informational purposes. The log is disabled by default.

Setting the Logger

To enable the log facility, provide an instance of *log.Logger.

import (
"encoding/json"
"fmt"
"log"
as "github.com/aerospike/aerospike-client-go/v7"
asl "github.com/aerospike/aerospike-client-go/v7/logger"
)
var buf bytes.Buffer
logger := log.New(&buf, "logger: ", log.Lshortfile)
asl.Logger.SetLogger(logger)

Setting the Log Level

To control the verbosity of logs sent to the logger, use logger.SetLevel():

import asl "github.com/aerospike/aerospike-client-go/logger"
asl.Logger.SetLevel(asl.INFO)

Log levels are defined in logger/logger.go.

Example

To log all debug messages, set the level to asl.DEBUG:

import asl "github.com/aerospike/aerospike-client-go/logger"
asl.Logger.SetLevel(asl.DEBUG)
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?