Troubleshooting C# SDK

How to enable logging

Required UserId

Always set the UserId to uniquely identify the user or device that connects to PubNub. This UserId should be persisted, and should remain unchanged for the lifetime of the user or the device. If you don't set the UserId, you won't be able to connect to PubNub.


var pubnubConfiguration = new PNConfiguration(new UserId("uniqueUserId"))
{
SubscribeKey = "[yourSubscribeKey]",
PublishKey = "[yourPublishKey]",
LogLevel = PubnubLogLevel.Debug,
};
var pubnub = new Pubnub(pubnubConfiguration);

var customLogger = new PubnubConsoleLogger();
pubnub.SetLogger(customLogger);

// A custom logger that logs information on console.
// Use can implement logger that can log information using log4Net or file etc.
public class PubnubConsoleLogger : IPubnubLogger
show all 36 lines
Last updated on