send-sls-logger 0.0.14 → 0.0.16
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/index.js +5 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -26,9 +26,6 @@ const formatLogData = (data, type = "log") => {
|
|
|
26
26
|
|
|
27
27
|
const send = (type) => {
|
|
28
28
|
return function (err) {
|
|
29
|
-
if (!opts.host || !opts.project || !opts.logstore) {
|
|
30
|
-
return console.error("日志初始化需要配置options");
|
|
31
|
-
}
|
|
32
29
|
let data = {};
|
|
33
30
|
if (typeof err === "string") {
|
|
34
31
|
data.msg = err;
|
|
@@ -43,6 +40,9 @@ const send = (type) => {
|
|
|
43
40
|
return;
|
|
44
41
|
}
|
|
45
42
|
const result = formatLogData(data, type);
|
|
43
|
+
if (!opts.host || !opts.project || !opts.logstore) {
|
|
44
|
+
return console.warn("日志初始化需要配置options", result);
|
|
45
|
+
}
|
|
46
46
|
tracker.send(result);
|
|
47
47
|
};
|
|
48
48
|
};
|
|
@@ -50,11 +50,13 @@ const send = (type) => {
|
|
|
50
50
|
const error = send("error");
|
|
51
51
|
const warn = send("warn");
|
|
52
52
|
const log = send("log");
|
|
53
|
+
const info = send("log");
|
|
53
54
|
|
|
54
55
|
export default {
|
|
55
56
|
error,
|
|
56
57
|
warn,
|
|
57
58
|
log,
|
|
59
|
+
info,
|
|
58
60
|
init: (config) => {
|
|
59
61
|
const { defaultData = {}, defaultExclude = [], options = {} } = config;
|
|
60
62
|
Object.assign(defaultLogData, defaultData);
|