Skip to content

Commit 20c9a96

Browse files
committed
fixup! Remove Chat SDK set up page
1 parent 2ccdebb commit 20c9a96

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

src/pages/docs/chat/connect.mdx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,72 @@ subscription.unsubscribe()
209209
<If lang="javascript,swift,kotlin">
210210
The discontinuity handler is accessible via the <If lang="javascript">[Room](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#onDiscontinuity)</If><If lang="swift">[Room](https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/room)</If><If lang="kotlin">[Room](https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-room/index.html)</If> object.
211211
</If>
212+
213+
## Logging <a id="logging"/>
214+
215+
Set the `logHandler` and `logLevel` properties when [instantiating a client](#instantiate) to configure your log handler:
216+
217+
<Code>
218+
```javascript
219+
const ably = new Ably.Realtime({ key: '{{API_KEY}}', clientId: '<clientId>'});
220+
const chatClient = new ChatClient(ably, {logHandler: logWriteFunc, logLevel: 'debug' });
221+
```
222+
223+
```react
224+
import * as Ably from 'ably';
225+
import { LogLevel } from '@ably/chat';
226+
import { ChatClientProvider } from '@ably/chat/react';
227+
228+
const ably = new Ably.Realtime({ key: '{{API_KEY}}', clientId: '<clientId>'});
229+
const chatClient = new ChatClient(ably, {logHandler: logWriteFunc, logLevel: 'debug' });
230+
231+
const App = => {
232+
return (
233+
<ChatClientProvider client={chatClient}>
234+
<RestOfYourApp />
235+
</ChatClientProvider>
236+
);
237+
};
238+
```
239+
240+
```swift
241+
let realtimeOptions = ARTClientOptions()
242+
realtimeOptions.key = "{{API_KEY}}"
243+
realtimeOptions.clientId = "<clientId>"
244+
let realtime = ARTRealtime(options: realtimeOptions)
245+
let clientOptions = ChatClientOptions(logHandler: SomeLogHandler(), logLevel: .debug)
246+
return DefaultChatClient(realtime: realtime, clientOptions: clientOptions)
247+
```
248+
249+
```kotlin
250+
val realtimeClient = AblyRealtime(
251+
ClientOptions().apply {
252+
key = "{{API_KEY}}"
253+
clientId = "<clientId>"
254+
},
255+
)
256+
val chatClient = ChatClient(realtimeClient) {
257+
logHandler = CustomLogHandler() // Implements com.ably.chat.LogHandler interface
258+
logLevel = LogLevel.Debug
259+
}
260+
```
261+
</Code>
262+
263+
<If lang="javascript,react">
264+
The `logHandler` property is your own function that will be called for each line of log output generated by the Chat SDK.
265+
</If>
266+
267+
<If lang="swift,kotlin">
268+
The `logHandler` property is your custom `LogHandler` implementation that will be called for each line of log output generated by the Chat SDK.
269+
</If>
270+
271+
The `logLevel` sets the verbosity of logs that will be output by the SDK. The following log levels are available to set:
272+
273+
| Level | Description |
274+
| ----- | ----------- |
275+
| trace | Something routine and expected has occurred. This level will provide logs for the vast majority of operations and function calls. |
276+
| debug | Development information, messages that are useful when trying to debug library behavior, but superfluous to normal operation. |
277+
| info | Informational messages. Operationally significant to the library but not out of the ordinary. |
278+
| warn | Anything that is not immediately an error, but could cause unexpected behavior in the future. For example, passing an invalid value to an option. Indicates that some action should be taken to prevent future errors. |
279+
| error | A given operation has failed and cannot be automatically recovered. The error may threaten the continuity of operation. |
280+
| silent | No logging will be performed. |

0 commit comments

Comments
 (0)