Logging for Go SDK

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.

package main

import (
"fmt"
"log"
"os"

pubnub "github.com/pubnub/go/v7"
)

func main() {
// Create a new PubNub configuration
config := pubnub.NewConfigWithUserId("loggingDemoUser")

// Set the subscribe and publish keys
show all 67 lines
Last updated on
On this page