-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
39 lines (35 loc) · 1005 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @providesModule RNAliyunLogModule
* @flow
*/
import { NativeModules, Platform } from 'react-native';
const AliyunLog = Platform.OS === 'ios' ? NativeModules.RNAliyunLogModule : NativeModules.AliyunLog;
/**
* 初始化日志服务
*
* @param endPoint
* @param accessKeyId
* @param accessKeySecret
* @param securityToken
* @param project
* @returns {*}
*/
function init(endPoint, accessKeyId, accessKeySecret, securityToken = null, project) {
return AliyunLog && AliyunLog.initAliyunLog && AliyunLog.initAliyunLog(endPoint, accessKeyId, accessKeySecret, securityToken, project);
}
/**
* 发送日志
*
* @param logStore
* @param topic
* @param source
* @param keyContents eg: [{ key: 'key1', content: 'content1' }, { key: 'key2', content: 'content2' }]
* @returns {*}
*/
function post(logStore, topic, source, keyContents) {
return AliyunLog && AliyunLog.postAliyunLog && AliyunLog.postAliyunLog(logStore, topic, source, keyContents);
}
export default {
init,
post
};