Skip to content

Commit

Permalink
Update README.md to include SDKLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
mliao95 authored Oct 16, 2024
1 parent 78b62e7 commit 70d9c6e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [GlobalConfig](#globalconfig)
* [GlobalConfig.init](#globalconfiginit)
* [Updating configuration](#updating-configuration)
* [SDKLogger](#sdklogger)
* [ChatSession APIs](#chatsession-apis)
* [ChatSession Events](#chatsession-events)
* [Classes and Structs](#classes-and-structs)
Expand Down Expand Up @@ -138,6 +139,41 @@ let globalConfig = GlobalConfig(region: .USEast1)
chatSession.configure(config: globalConfig)
```

### SDKLogger
The `SDKLogger` class is responsible for logging relevant runtime information to the console which is useful for debugging purposes. The `SDKLogger` will log key events such as establishing a connection or failures such as failing to send a message.

#### `SDKLogger.configure`
This API will allow you to override the SDK's built-in logger with your own [SDKLoggerProtocol](#sdkloggerprotocol) implementation. This is especially useful in cases where you would want to store logs for debugging purposes. Attaching these logs to issues filed in this project will greatly expedite the resolution process.

```
public static func configureLogger(_ logger: SDKLoggerProtocol) {
SDKLogger.logger = logger
}
```

#### SDKLoggerProtocol
The SDKLoggerProtocol is a protocol used for the `SDKLogger`. Users can override the `SDKLogger` with any class that implements SDKLoggerProtocol.

```
public protocol SDKLoggerProtocol {
func logVerbose(
_ message: @autoclosure () -> String
)
func logInfo(
_ message: @autoclosure () -> String
)
func logDebug(
_ message: @autoclosure () -> String
)
func logFault(
_ message: @autoclosure () -> String
)
func logError(
_ message: @autoclosure () -> String
)
}
```

--------------------

### ChatSession APIs
Expand Down

0 comments on commit 70d9c6e

Please sign in to comment.