@be-link/cls-logger 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -12
- package/dist/ClsLoggerCore.d.ts.map +1 -1
- package/dist/index.esm.js +5 -5
- package/dist/index.js +5 -5
- package/dist/index.umd.js +5 -5
- package/dist/mini.esm.js +5 -5
- package/dist/mini.js +5 -5
- package/dist/types.d.ts +7 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/web.esm.js +5 -5
- package/dist/web.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,10 +26,12 @@ import clsLogger from '@be-link/cls-logger';
|
|
|
26
26
|
clsLogger.init({
|
|
27
27
|
projectId: 'my-project',
|
|
28
28
|
appId: 'my-app-id',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
// 默认配置可不传
|
|
30
|
+
// tencentCloud: {
|
|
31
|
+
// endpoint: 'https://ap-shanghai.cls.tencentcs.com',
|
|
32
|
+
// topicID: '17475bcd-6315-4b20-859c-e7b087fb3683',
|
|
33
|
+
// },
|
|
34
|
+
source: 'my-source',
|
|
33
35
|
});
|
|
34
36
|
```
|
|
35
37
|
|
|
@@ -45,10 +47,8 @@ import { clsLogger } from '@be-link/cls-logger/web';
|
|
|
45
47
|
|
|
46
48
|
clsLogger.init({
|
|
47
49
|
projectId: 'my-web-project',
|
|
48
|
-
tencentCloud: {
|
|
49
|
-
|
|
50
|
-
topicID: 'your-web-topic-id',
|
|
51
|
-
},
|
|
50
|
+
// tencentCloud: { ... }, // 可选
|
|
51
|
+
source: 'web-source',
|
|
52
52
|
});
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -61,10 +61,8 @@ import { clsLogger } from '@be-link/cls-logger/mini';
|
|
|
61
61
|
clsLogger.init({
|
|
62
62
|
projectId: 'my-mini-project',
|
|
63
63
|
appId: 'wx123456789', // 小程序建议传入 appId
|
|
64
|
-
tencentCloud: {
|
|
65
|
-
|
|
66
|
-
topicID: 'your-mini-topic-id',
|
|
67
|
-
},
|
|
64
|
+
// tencentCloud: { ... }, // 可选
|
|
65
|
+
source: 'mini-source',
|
|
68
66
|
});
|
|
69
67
|
```
|
|
70
68
|
|
|
@@ -134,7 +132,15 @@ clsLogger.stat({
|
|
|
134
132
|
- **UV ID**: 自动生成并持久化。小程序环境下优先尝试使用 `openid`。
|
|
135
133
|
- **点击追踪**: 自动监听点击事件。
|
|
136
134
|
- **Web**: 识别带 `data-track-id` 的元素。
|
|
135
|
+
```html
|
|
136
|
+
<!-- HTML -->
|
|
137
|
+
<button data-track-id="submit_btn">提交</button>
|
|
138
|
+
```
|
|
137
139
|
- **小程序**: 识别带 `data-track-id` 的组件(需在 `dataset` 中)。
|
|
140
|
+
```html
|
|
141
|
+
<!-- WXML -->
|
|
142
|
+
<button data-track-id="submit_btn" bindtap="handleClick">提交</button>
|
|
143
|
+
```
|
|
138
144
|
|
|
139
145
|
## 高级用法
|
|
140
146
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClsLoggerCore.d.ts","sourceRoot":"","sources":["../src/ClsLoggerCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,OAAO,EACP,UAAU,EACV,yBAAyB,EACzB,UAAU,EACV,SAAS,EACT,SAAS,EACT,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAWjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAYlD;;;;;GAKG;AACH,8BAAsB,aAAa;IACjC,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAAQ;IAC1C,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAQ;IAC1D,SAAS,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAQ;IAC7C,SAAS,CAAC,iB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AAC,iBAAiB;YAmBX,cAAc;IAgC5B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,qBAAqB;IAc7B,WAAW,IAAI,IAAI;IAmBnB;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI;CAcjG"}
|
package/dist/index.esm.js
CHANGED
|
@@ -154,9 +154,9 @@ class ClsLoggerCore {
|
|
|
154
154
|
this.sdkLoaderOverride = null;
|
|
155
155
|
this.client = null;
|
|
156
156
|
this.clientPromise = null;
|
|
157
|
-
this.topicId =
|
|
158
|
-
this.endpoint = 'ap-shanghai.cls.tencentcs.com';
|
|
159
|
-
this.retryTimes =
|
|
157
|
+
this.topicId = '17475bcd-6315-4b20-859c-e7b087fb3683';
|
|
158
|
+
this.endpoint = 'https://ap-shanghai.cls.tencentcs.com';
|
|
159
|
+
this.retryTimes = 3;
|
|
160
160
|
this.source = '127.0.0.1';
|
|
161
161
|
this.enabled = true;
|
|
162
162
|
this.projectId = '';
|
|
@@ -201,10 +201,10 @@ class ClsLoggerCore {
|
|
|
201
201
|
}
|
|
202
202
|
init(options) {
|
|
203
203
|
this.initTs = Date.now();
|
|
204
|
-
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId
|
|
204
|
+
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId;
|
|
205
205
|
const endpoint = options?.tencentCloud?.endpoint ?? options?.endpoint ?? this.endpoint;
|
|
206
206
|
const retryTimes = options?.tencentCloud?.retry_times ?? options?.retry_times ?? this.retryTimes;
|
|
207
|
-
const source = options?.
|
|
207
|
+
const source = options?.source ?? this.source;
|
|
208
208
|
if (!topicId) {
|
|
209
209
|
// eslint-disable-next-line no-console
|
|
210
210
|
console.warn('ClsLogger.init 没有传 topicID/topic_id');
|
package/dist/index.js
CHANGED
|
@@ -158,9 +158,9 @@ class ClsLoggerCore {
|
|
|
158
158
|
this.sdkLoaderOverride = null;
|
|
159
159
|
this.client = null;
|
|
160
160
|
this.clientPromise = null;
|
|
161
|
-
this.topicId =
|
|
162
|
-
this.endpoint = 'ap-shanghai.cls.tencentcs.com';
|
|
163
|
-
this.retryTimes =
|
|
161
|
+
this.topicId = '17475bcd-6315-4b20-859c-e7b087fb3683';
|
|
162
|
+
this.endpoint = 'https://ap-shanghai.cls.tencentcs.com';
|
|
163
|
+
this.retryTimes = 3;
|
|
164
164
|
this.source = '127.0.0.1';
|
|
165
165
|
this.enabled = true;
|
|
166
166
|
this.projectId = '';
|
|
@@ -205,10 +205,10 @@ class ClsLoggerCore {
|
|
|
205
205
|
}
|
|
206
206
|
init(options) {
|
|
207
207
|
this.initTs = Date.now();
|
|
208
|
-
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId
|
|
208
|
+
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId;
|
|
209
209
|
const endpoint = options?.tencentCloud?.endpoint ?? options?.endpoint ?? this.endpoint;
|
|
210
210
|
const retryTimes = options?.tencentCloud?.retry_times ?? options?.retry_times ?? this.retryTimes;
|
|
211
|
-
const source = options?.
|
|
211
|
+
const source = options?.source ?? this.source;
|
|
212
212
|
if (!topicId) {
|
|
213
213
|
// eslint-disable-next-line no-console
|
|
214
214
|
console.warn('ClsLogger.init 没有传 topicID/topic_id');
|
package/dist/index.umd.js
CHANGED
|
@@ -160,9 +160,9 @@
|
|
|
160
160
|
this.sdkLoaderOverride = null;
|
|
161
161
|
this.client = null;
|
|
162
162
|
this.clientPromise = null;
|
|
163
|
-
this.topicId =
|
|
164
|
-
this.endpoint = 'ap-shanghai.cls.tencentcs.com';
|
|
165
|
-
this.retryTimes =
|
|
163
|
+
this.topicId = '17475bcd-6315-4b20-859c-e7b087fb3683';
|
|
164
|
+
this.endpoint = 'https://ap-shanghai.cls.tencentcs.com';
|
|
165
|
+
this.retryTimes = 3;
|
|
166
166
|
this.source = '127.0.0.1';
|
|
167
167
|
this.enabled = true;
|
|
168
168
|
this.projectId = '';
|
|
@@ -207,10 +207,10 @@
|
|
|
207
207
|
}
|
|
208
208
|
init(options) {
|
|
209
209
|
this.initTs = Date.now();
|
|
210
|
-
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId
|
|
210
|
+
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId;
|
|
211
211
|
const endpoint = options?.tencentCloud?.endpoint ?? options?.endpoint ?? this.endpoint;
|
|
212
212
|
const retryTimes = options?.tencentCloud?.retry_times ?? options?.retry_times ?? this.retryTimes;
|
|
213
|
-
const source = options?.
|
|
213
|
+
const source = options?.source ?? this.source;
|
|
214
214
|
if (!topicId) {
|
|
215
215
|
// eslint-disable-next-line no-console
|
|
216
216
|
console.warn('ClsLogger.init 没有传 topicID/topic_id');
|
package/dist/mini.esm.js
CHANGED
|
@@ -156,9 +156,9 @@ class ClsLoggerCore {
|
|
|
156
156
|
this.sdkLoaderOverride = null;
|
|
157
157
|
this.client = null;
|
|
158
158
|
this.clientPromise = null;
|
|
159
|
-
this.topicId =
|
|
160
|
-
this.endpoint = 'ap-shanghai.cls.tencentcs.com';
|
|
161
|
-
this.retryTimes =
|
|
159
|
+
this.topicId = '17475bcd-6315-4b20-859c-e7b087fb3683';
|
|
160
|
+
this.endpoint = 'https://ap-shanghai.cls.tencentcs.com';
|
|
161
|
+
this.retryTimes = 3;
|
|
162
162
|
this.source = '127.0.0.1';
|
|
163
163
|
this.enabled = true;
|
|
164
164
|
this.projectId = '';
|
|
@@ -203,10 +203,10 @@ class ClsLoggerCore {
|
|
|
203
203
|
}
|
|
204
204
|
init(options) {
|
|
205
205
|
this.initTs = Date.now();
|
|
206
|
-
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId
|
|
206
|
+
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId;
|
|
207
207
|
const endpoint = options?.tencentCloud?.endpoint ?? options?.endpoint ?? this.endpoint;
|
|
208
208
|
const retryTimes = options?.tencentCloud?.retry_times ?? options?.retry_times ?? this.retryTimes;
|
|
209
|
-
const source = options?.
|
|
209
|
+
const source = options?.source ?? this.source;
|
|
210
210
|
if (!topicId) {
|
|
211
211
|
// eslint-disable-next-line no-console
|
|
212
212
|
console.warn('ClsLogger.init 没有传 topicID/topic_id');
|
package/dist/mini.js
CHANGED
|
@@ -179,9 +179,9 @@ class ClsLoggerCore {
|
|
|
179
179
|
this.sdkLoaderOverride = null;
|
|
180
180
|
this.client = null;
|
|
181
181
|
this.clientPromise = null;
|
|
182
|
-
this.topicId =
|
|
183
|
-
this.endpoint = 'ap-shanghai.cls.tencentcs.com';
|
|
184
|
-
this.retryTimes =
|
|
182
|
+
this.topicId = '17475bcd-6315-4b20-859c-e7b087fb3683';
|
|
183
|
+
this.endpoint = 'https://ap-shanghai.cls.tencentcs.com';
|
|
184
|
+
this.retryTimes = 3;
|
|
185
185
|
this.source = '127.0.0.1';
|
|
186
186
|
this.enabled = true;
|
|
187
187
|
this.projectId = '';
|
|
@@ -226,10 +226,10 @@ class ClsLoggerCore {
|
|
|
226
226
|
}
|
|
227
227
|
init(options) {
|
|
228
228
|
this.initTs = Date.now();
|
|
229
|
-
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId
|
|
229
|
+
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId;
|
|
230
230
|
const endpoint = options?.tencentCloud?.endpoint ?? options?.endpoint ?? this.endpoint;
|
|
231
231
|
const retryTimes = options?.tencentCloud?.retry_times ?? options?.retry_times ?? this.retryTimes;
|
|
232
|
-
const source = options?.
|
|
232
|
+
const source = options?.source ?? this.source;
|
|
233
233
|
if (!topicId) {
|
|
234
234
|
// eslint-disable-next-line no-console
|
|
235
235
|
console.warn('ClsLogger.init 没有传 topicID/topic_id');
|
package/dist/types.d.ts
CHANGED
|
@@ -15,13 +15,11 @@ export type BaseFields = FlatFields;
|
|
|
15
15
|
export type EnvType = 'browser' | 'miniprogram';
|
|
16
16
|
export interface TencentCloudClsConfig {
|
|
17
17
|
/** CLS endpoint,例如 ap-shanghai.cls.tencentcs.com */
|
|
18
|
-
endpoint
|
|
18
|
+
endpoint?: string;
|
|
19
19
|
/** CLS TopicId */
|
|
20
|
-
topicID
|
|
20
|
+
topicID?: string;
|
|
21
21
|
/** SDK 重试次数 */
|
|
22
22
|
retry_times?: number;
|
|
23
|
-
/** CLS source(可选) */
|
|
24
|
-
source?: string;
|
|
25
23
|
}
|
|
26
24
|
export interface BatchOptions {
|
|
27
25
|
/** 内存队列达到多少条触发 flush,默认 20 */
|
|
@@ -54,9 +52,13 @@ export interface ClsLoggerBaseOptions {
|
|
|
54
52
|
appVersion?: string;
|
|
55
53
|
/**
|
|
56
54
|
* 腾讯云 CLS 配置(推荐)
|
|
57
|
-
* - endpoint/topicID/retry_times
|
|
55
|
+
* - endpoint/topicID/retry_times
|
|
58
56
|
*/
|
|
59
57
|
tencentCloud?: TencentCloudClsConfig;
|
|
58
|
+
/**
|
|
59
|
+
* CLS source
|
|
60
|
+
*/
|
|
61
|
+
source?: string;
|
|
60
62
|
/**
|
|
61
63
|
* (可选)手动注入 CLS SDK(用于小程序/特殊构建环境无法 dynamic import/require 的场景)
|
|
62
64
|
* - 小程序推荐:`import * as clsMini from 'tencentcloud-cls-sdk-js-mini'` 后传入 `sdk: clsMini`
|
|
@@ -75,7 +77,6 @@ export interface ClsLoggerBaseOptions {
|
|
|
75
77
|
topicID?: string;
|
|
76
78
|
endpoint?: string;
|
|
77
79
|
retry_times?: number;
|
|
78
|
-
source?: string;
|
|
79
80
|
userId?: string;
|
|
80
81
|
userName?: string;
|
|
81
82
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,sCAAsC;AACtC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAExD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AAEpC,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAEhD,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,sCAAsC;AACtC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAExD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AAEpC,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAEhD,MAAM,WAAW,qBAAqB;I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;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE;QACb;;;;WAIG;QACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,yBAAyB;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
|
package/dist/web.esm.js
CHANGED
|
@@ -156,9 +156,9 @@ class ClsLoggerCore {
|
|
|
156
156
|
this.sdkLoaderOverride = null;
|
|
157
157
|
this.client = null;
|
|
158
158
|
this.clientPromise = null;
|
|
159
|
-
this.topicId =
|
|
160
|
-
this.endpoint = 'ap-shanghai.cls.tencentcs.com';
|
|
161
|
-
this.retryTimes =
|
|
159
|
+
this.topicId = '17475bcd-6315-4b20-859c-e7b087fb3683';
|
|
160
|
+
this.endpoint = 'https://ap-shanghai.cls.tencentcs.com';
|
|
161
|
+
this.retryTimes = 3;
|
|
162
162
|
this.source = '127.0.0.1';
|
|
163
163
|
this.enabled = true;
|
|
164
164
|
this.projectId = '';
|
|
@@ -203,10 +203,10 @@ class ClsLoggerCore {
|
|
|
203
203
|
}
|
|
204
204
|
init(options) {
|
|
205
205
|
this.initTs = Date.now();
|
|
206
|
-
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId
|
|
206
|
+
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId;
|
|
207
207
|
const endpoint = options?.tencentCloud?.endpoint ?? options?.endpoint ?? this.endpoint;
|
|
208
208
|
const retryTimes = options?.tencentCloud?.retry_times ?? options?.retry_times ?? this.retryTimes;
|
|
209
|
-
const source = options?.
|
|
209
|
+
const source = options?.source ?? this.source;
|
|
210
210
|
if (!topicId) {
|
|
211
211
|
// eslint-disable-next-line no-console
|
|
212
212
|
console.warn('ClsLogger.init 没有传 topicID/topic_id');
|
package/dist/web.js
CHANGED
|
@@ -179,9 +179,9 @@ class ClsLoggerCore {
|
|
|
179
179
|
this.sdkLoaderOverride = null;
|
|
180
180
|
this.client = null;
|
|
181
181
|
this.clientPromise = null;
|
|
182
|
-
this.topicId =
|
|
183
|
-
this.endpoint = 'ap-shanghai.cls.tencentcs.com';
|
|
184
|
-
this.retryTimes =
|
|
182
|
+
this.topicId = '17475bcd-6315-4b20-859c-e7b087fb3683';
|
|
183
|
+
this.endpoint = 'https://ap-shanghai.cls.tencentcs.com';
|
|
184
|
+
this.retryTimes = 3;
|
|
185
185
|
this.source = '127.0.0.1';
|
|
186
186
|
this.enabled = true;
|
|
187
187
|
this.projectId = '';
|
|
@@ -226,10 +226,10 @@ class ClsLoggerCore {
|
|
|
226
226
|
}
|
|
227
227
|
init(options) {
|
|
228
228
|
this.initTs = Date.now();
|
|
229
|
-
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId
|
|
229
|
+
const topicId = options?.tencentCloud?.topicID ?? options?.topic_id ?? options?.topicID ?? this.topicId;
|
|
230
230
|
const endpoint = options?.tencentCloud?.endpoint ?? options?.endpoint ?? this.endpoint;
|
|
231
231
|
const retryTimes = options?.tencentCloud?.retry_times ?? options?.retry_times ?? this.retryTimes;
|
|
232
|
-
const source = options?.
|
|
232
|
+
const source = options?.source ?? this.source;
|
|
233
233
|
if (!topicId) {
|
|
234
234
|
// eslint-disable-next-line no-console
|
|
235
235
|
console.warn('ClsLogger.init 没有传 topicID/topic_id');
|