Skip to content

Commit cb1f8f4

Browse files
committed
Migration guide
1 parent c9702d1 commit cb1f8f4

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Documentation/PubNub_10_0_Migration_Guide.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ This guide is meant to ease the transition to the 10.0 version of the SDK. To re
1010

1111
#### 1.1 LogWriter Protocol Changes
1212

13-
The `LogWriter` protocol method signature has changed. You must update your custom `LogWriter` implementations (if any):
13+
> **Note:** Skip this point if you haven't implemented a custom `LogWriter`.
14+
15+
The `LogWriter` protocol method signature has changed. You must update your custom `LogWriter` implementations:
1416

1517
```swift
1618
// Before (9.0):
@@ -29,17 +31,19 @@ func send(
2931

3032
**Key Changes:**
3133

32-
1. **`LogType` renamed to `LogLevel`** - A new `trace` level has been added as the lowest severity level for detailed debugging
33-
2. **Structured Messages** - `LogMessage` objects replace simple strings with rich data:
34+
1. **`LogType` renamed to `LogLevel`**:
35+
- **Type name change**: `LogType` is now `LogLevel`
36+
- **New level added**: `trace` level as the lowest severity for detailed debugging
37+
2. **Structured Messages** - `LogMessage` objects replace simple strings. Its `message` property contains rich data:
3438
- `.text(String)` - Simple text messages
3539
- `.networkRequest(NetworkRequest)` - HTTP request details with ID, URL, headers, body, and status
3640
- `.networkResponse(NetworkResponse)` - HTTP response details with status code, headers, and body
3741
- `.customObject(CustomObject)` - Method calls/events with operation name and arguments
38-
3. **Efficient Filtering** - `LogMetadata` (containing level and category) lets log writers check whether to log before evaluating the `@autoclosure` message parameter, avoiding expensive message construction for filtered logs
42+
3. **New `metadata` parameter** - The `LogMetadata` type contains the `level` and `category` of the message being logged. This allows your log writer to inspect these properties for filtering specific log messages without evaluating the potentially expensive `LogMessage`:
3943

4044
#### 1.2 Logger Configuration
4145

42-
The way to attach a logger to PubNub has changed. The static `log` and `logLog` properties have been removed. **Logging is now disabled by default**, so you must explicitly enable it:
46+
The way to attach a logger to PubNub has changed. The static `log` and `logLog` properties have been removed. **Logging is now disabled by default** and must be configured through the PubNub initializer:
4347

4448
```swift
4549
// Before (9.0):
@@ -58,24 +62,25 @@ pubnub.logLevel = [.error, .warn]
5862

5963
#### 1.3 PubNubLogger Methods No Longer Public
6064

61-
The logging methods (`debug`, `info`, `event`, `warn`, `error`, `custom`) on `PubNubLogger` are no longer public. The SDK's logging system is designed exclusively for internal SDK operations. If you were using these methods for custom application logging, use your own logging solution instead.
65+
The logging methods (`debug`, `info`, `event`, `warn`, `error`) on `PubNubLogger` are no longer public API. You can no longer use `PubNubLogger` to log your own application messages. The SDK's logging system is designed exclusively for internal SDK operations.
6266

6367
```swift
6468
// Before (9.0):
6569
PubNub.log.debug("Custom debug message") // ✅ This worked
6670

6771
// Now (10.0):
68-
pubNub.logger.debug("Custom debug message") // ❌ No longer available
72+
pubnub.logger.debug("Custom debug message") // ❌ No longer available
6973
```
74+
___
7075

7176
### 2. Presence API Changes
7277

73-
#### 2.1 HereNow Method Pagination
78+
#### 2.1 HereNow Changes
7479

7580
**Key Changes:**
7681

7782
1. **New Parameters** - Two pagination parameters added:
78-
- `limit: Int` (default: 1000) - Maximum occupants per request
83+
- `limit: Int` (default: 1000) - Maximum occupants per channel
7984
- `offset: Int?` (default: 0) - Starting position for pagination
8085

8186
```swift

0 commit comments

Comments
 (0)