uploadLogs
Description
info
Upload SDK logs to the server for problem analysis and positioning. line is the number of lines to upload. When line is 0, all logs are uploaded.
Note
This interface is expected to be updated.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron
- React-Native
Function Prototype
Future uploadLogs({
String? ex,
int line = 0,
String? operationID,
})
Input Parameters
None
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| ~ | ~ | Returns success if no exception is thrown |
Code Example
await OpenIM.iMManager.uploadLogs();
// todo
Function Prototype
- (void)uploadLogsWithProgress:(OIMUploadProgressCallback)onProgress
line:(NSInteger )line
ex:(NSString *)ex
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure;
Input Parameters
None
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| onSuccess | OIMSuccessCallback | Success return |
| onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager uploadLogsWithProgress:^(NSInteger saveBytes, NSInteger currentBytes, NSInteger totalBytes) {
} line:0 ex:nil onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void getSelfUserInfo(OnBase<UserInfo> callBack)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| callBack | OnBase<UserInfo> | Yes | Callback interface |
Return Result
Code Example
OpenIMClient.getInstance().friendshipManager.getSelfUserInfo(new OnBase<UserInfo>(){…})
Note
@openim/client-sdk and @openim/wasm-client-sdk do not provide this method. It can only be called if @openim/electron-client-sdk is introduced in electron using the ffi method.
Function Prototype
IMSDK.uploadLogs({
line: number,
ex: string,
}, operationID?: string): Promise<WsResponse>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| line | number | Yes | Number of lines to upload from back to front |
| ex | string | Yes | Extra fields |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<WsResponse> | Success callback |
| Promise.catch() | Promise<WsResponse> | Failure callback |
Code Example
// use in electron with ffi
import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
const { instance: IMSDK } = getWithRenderProcess();
IMSDK.uploadLogs({ line: 10000, ex: "" })
.then(() => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
IMSDK.asyncApi('uploadLogs', operationID: string, {
line: number,
ex: string,
}): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| line | number | Yes | Number of lines to upload from back to front |
| ex | string | Yes | Extra fields |
| operationID | string | Yes | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
Use the
openim-uniapp-polyfillpackage to make the function Promise. When calling, you need to usethenandcatchto determine and handle success and failure callbacks.
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<void> | Success callback |
| Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('uploadLogs', IMSDK.uuid(), { line: 10000, ex: "" })
.then(() => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDK.uploadLogs({
line: number,
ex: string,
}, operationID?: string): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| line | number | Yes | Number of lines to upload from back to front |
| ex | string | Yes | Extra fields |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<void> | Success callback |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from "@openim/rn-client-sdk";
OpenIMSDK.uploadLogs({ line: 10000, ex: "" })
.then(() => {
// Call successful
})
.catch((error) => {
// Call failed
});