@zxhy-npm/send-sls-logger 1.1.7 → 1.1.9
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/lib/init.js +2 -1
- package/lib/trace.js +15 -0
- package/package.json +1 -1
package/lib/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deviceInfo, referUrl } from "./trace";
|
|
1
|
+
import { deviceInfo, isPC, mobileInfo, referUrl } from "./trace";
|
|
2
2
|
const getType = (val) => {
|
|
3
3
|
return Object.prototype.toString.call(val).toLocaleLowerCase().slice(8, -1);
|
|
4
4
|
};
|
|
@@ -121,6 +121,7 @@ class DefaultLog {
|
|
|
121
121
|
pageName: () => document.title,
|
|
122
122
|
referUrl: () => referUrl.referUrl,
|
|
123
123
|
deviceInfo,
|
|
124
|
+
terminal: isPC ? 'PC' : mobileInfo.split(' ')[0],
|
|
124
125
|
...data,
|
|
125
126
|
}), type);
|
|
126
127
|
const isExcludeMsg = Object.keys(result).find((key) => {
|
package/lib/trace.js
CHANGED
|
@@ -162,6 +162,11 @@ export const mobileInfo = (() => {
|
|
|
162
162
|
const match = ua.match(/MicroMessenger\/([\d.]+)/);
|
|
163
163
|
browserVersion = match ? match[1] : '';
|
|
164
164
|
}
|
|
165
|
+
else if (ua.indexOf('DingTalk') > -1) {
|
|
166
|
+
browserName = 'DingTalk';
|
|
167
|
+
const match = ua.match(/DingTalk\/([\d.]+)/);
|
|
168
|
+
browserVersion = match ? match[1] : '';
|
|
169
|
+
}
|
|
165
170
|
else if (ua.indexOf('AlipayClient') > -1) {
|
|
166
171
|
browserName = 'Alipay';
|
|
167
172
|
const match = ua.match(/AlipayClient\/([\d.]+)/);
|
|
@@ -172,6 +177,16 @@ export const mobileInfo = (() => {
|
|
|
172
177
|
const match = ua.match(/QQ\/([\d.]+)/);
|
|
173
178
|
browserVersion = match ? match[1] : '';
|
|
174
179
|
}
|
|
180
|
+
else if (ua.indexOf('BytedanceWebview') > -1) {
|
|
181
|
+
browserName = 'Douyin';
|
|
182
|
+
const match = ua.match(/BytedanceWebview\/([\d.]+)/);
|
|
183
|
+
browserVersion = match ? match[1] : '';
|
|
184
|
+
}
|
|
185
|
+
else if (ua.indexOf('Weibo') > -1) {
|
|
186
|
+
browserName = 'Weibo';
|
|
187
|
+
const match = ua.match(/Weibo\/([\d.]+)/);
|
|
188
|
+
browserVersion = match ? match[1] : '';
|
|
189
|
+
}
|
|
175
190
|
else if (ua.indexOf('UCBrowser') > -1) {
|
|
176
191
|
browserName = 'UC';
|
|
177
192
|
const match = ua.match(/UCBrowser\/([\d.]+)/);
|