Logging for Go SDK
This page explains how to enable logging in the PubNub Go Software Development Kit (SDK) using a custom log.Logger
.
To enable logging, you need to init by specifying the logger
instance in messaging.NewPubnub
.
Required UUID
Always set the UUID
to uniquely identify the user or device that connects to PubNub. This UUID
should be persisted, and should remain unchanged for the lifetime of the user or the device. If you don't set the UUID
, you won't be able to connect to PubNub.
1package main
2
3import (
4 "fmt"
5 "log"
6 "os"
7
8 pubnub "github.com/pubnub/go/v7"
9)
10
11func main() {
12 // Create a new PubNub configuration
13 config := pubnub.NewConfigWithUserId("loggingDemoUser")
14
15 // Set the subscribe and publish keys
show all 67 lines