@zxhy-npm/send-sls-logger 1.1.4 → 1.1.6
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 +11 -2
- package/package.json +1 -1
- package/readme.md +2 -0
package/lib/init.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deviceInfo, referUrl } from "./trace";
|
|
1
2
|
const getType = (val) => {
|
|
2
3
|
return Object.prototype.toString.call(val).toLocaleLowerCase().slice(8, -1);
|
|
3
4
|
};
|
|
@@ -115,7 +116,13 @@ class DefaultLog {
|
|
|
115
116
|
else if (typeof err === 'object') {
|
|
116
117
|
data = { ...err };
|
|
117
118
|
}
|
|
118
|
-
const result = formatLogData.call(this, deleteNullOrUndefined(
|
|
119
|
+
const result = formatLogData.call(this, deleteNullOrUndefined({
|
|
120
|
+
pagePath: () => location.href,
|
|
121
|
+
pageName: () => document.title,
|
|
122
|
+
referUrl: () => referUrl.referUrl,
|
|
123
|
+
deviceInfo,
|
|
124
|
+
...data,
|
|
125
|
+
}), type);
|
|
119
126
|
const isExcludeMsg = Object.keys(result).find((key) => {
|
|
120
127
|
return exclude.find((i) => new RegExp(i, 'g').test(result[key]));
|
|
121
128
|
});
|
|
@@ -136,7 +143,9 @@ class DefaultLog {
|
|
|
136
143
|
else {
|
|
137
144
|
debug && console.log(`logger ${type}`, formatResultObj);
|
|
138
145
|
}
|
|
139
|
-
tracker.send(
|
|
146
|
+
tracker.send({
|
|
147
|
+
...formatResultObj,
|
|
148
|
+
});
|
|
140
149
|
}
|
|
141
150
|
send(type) {
|
|
142
151
|
const self = this;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -52,3 +52,5 @@ miniLog.info({ msg: "这是一条默认日志" });
|
|
|
52
52
|
更新内容: 会自动删除 预发送数据 中的 undefined 与 null
|
|
53
53
|
1.1.4 ---------- 1/10/2025, 11:35:16 AM
|
|
54
54
|
更新内容: trace 导出deviceInfo 以及 referUrl
|
|
55
|
+
1.1.5 ---------- 1/10/2025, 11:40:55 AM
|
|
56
|
+
更新内容: sls 打日志的时候,将deviceInfo、referUrl、pagePath, pageName直接带进去,不需要使用者增加
|