Logging for 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.
Additional logging details
-
LogLevel options: The SDK supports various log levels:
PubnubLogLevel.All
,PubnubLogLevel.Trace
,PubnubLogLevel.Debug
,PubnubLogLevel.Info
,PubnubLogLevel.Warn
,PubnubLogLevel.Error
, andPubnubLogLevel.None
(which disables logging). Only logs with severity equal to or higher than the configured level will be generated. -
Default logging: The SDK automatically initializes a basic logger when you create a Pubnub instance. The log level you specify in your configuration controls what level of logs are generated.
-
Multiple loggers: You can attach multiple custom loggers by calling
SetLogger()
with different logger implementations. This allows you to simultaneously log to different outputs (console, file, etc.).