@wiajs/log 4.3.15 → 4.3.16
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/log.bs.cjs +155 -161
- package/dist/log.js +183 -181
- package/dist/log.mjs +155 -161
- package/lib/browser.js +57 -53
- package/lib/node.js +24 -18
- package/package.json +1 -1
package/dist/log.mjs
CHANGED
@@ -9,135 +9,132 @@
|
|
9
9
|
* m 为模块,fn 为函数名称
|
10
10
|
*/
|
11
11
|
class Log {
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
args[0] = { exp: args[0].message };
|
123
|
-
_.error(...args);
|
124
|
-
}
|
12
|
+
/** @type {string} 模块 */
|
13
|
+
m = ''
|
14
|
+
|
15
|
+
/** @type {string} 函数 */
|
16
|
+
fn = ''
|
17
|
+
|
18
|
+
/**
|
19
|
+
* @param {string} m 模块
|
20
|
+
*/
|
21
|
+
constructor(m) {
|
22
|
+
this.m = m;
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* get log desc
|
27
|
+
* 描述字符串作为最后参数调用,显示时,前置
|
28
|
+
* @param {*[]} args
|
29
|
+
* @returns {{desc: string, arg: *[]}}
|
30
|
+
*/
|
31
|
+
getDesc(args) {
|
32
|
+
let R = {desc: '', arg: args};
|
33
|
+
try {
|
34
|
+
const _ = this;
|
35
|
+
const {m} = _;
|
36
|
+
let fn = '';
|
37
|
+
let desc = '';
|
38
|
+
|
39
|
+
if (args.length > 1) {
|
40
|
+
const last = args.at(-1);
|
41
|
+
if (typeof last === 'object') {
|
42
|
+
;({desc, fn} = last);
|
43
|
+
} else if (typeof last === 'string') desc = last;
|
44
|
+
if (desc || fn) {
|
45
|
+
fn = fn || _.fn;
|
46
|
+
_.fn = fn;
|
47
|
+
args.pop();
|
48
|
+
}
|
49
|
+
}
|
50
|
+
fn = fn || _.fn;
|
51
|
+
if (m) desc = `${desc}[${m}${fn ? `:${fn}` : ''}]`; // eslint-disable-line
|
52
|
+
R = {desc, arg: args};
|
53
|
+
} catch (e) {
|
54
|
+
console.error(`getDesc exp:${e.message}`);
|
55
|
+
}
|
56
|
+
|
57
|
+
return R
|
58
|
+
}
|
59
|
+
|
60
|
+
/** @param {...any} args - params */
|
61
|
+
log(...args) {
|
62
|
+
const _ = this;
|
63
|
+
const last = args.at(-1);
|
64
|
+
// clear fn
|
65
|
+
if (args.length === 1 && typeof last === 'object' && last.fn) _.fn = '';
|
66
|
+
else {
|
67
|
+
const desc = _.getDesc(args);
|
68
|
+
console.log(desc, ...args);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
/** @param {...any} args - params */
|
73
|
+
debug(...args) {
|
74
|
+
const _ = this;
|
75
|
+
const desc = _.getDesc(args);
|
76
|
+
if (desc) console.log(desc, ...args);
|
77
|
+
else console.log(...args);
|
78
|
+
}
|
79
|
+
|
80
|
+
/** @param {...any} args - params */
|
81
|
+
info(...args) {
|
82
|
+
const _ = this;
|
83
|
+
const desc = _.getDesc(args);
|
84
|
+
if (desc) console.info(desc, ...args);
|
85
|
+
else console.log(...args);
|
86
|
+
}
|
87
|
+
|
88
|
+
/** @param {...any} args - params */
|
89
|
+
warn(...args) {
|
90
|
+
const _ = this;
|
91
|
+
const {desc, arg} = _.getDesc(args);
|
92
|
+
if (desc) console.warn(desc, ...arg);
|
93
|
+
else console.log(...args);
|
94
|
+
}
|
95
|
+
|
96
|
+
/** @param {...any} args - params */
|
97
|
+
trace(...args) {
|
98
|
+
const _ = this;
|
99
|
+
const {desc, arg} = _.getDesc(args);
|
100
|
+
if (desc) console.trace(desc, ...arg);
|
101
|
+
else console.trace(...args);
|
102
|
+
}
|
103
|
+
|
104
|
+
/** @param {...any} args - params */
|
105
|
+
error(...args) {
|
106
|
+
const _ = this;
|
107
|
+
const {desc, arg} = _.getDesc(args);
|
108
|
+
if (desc) console.error(desc, ...arg);
|
109
|
+
else console.log(...args);
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* 用于 catch(e) log.err(e)
|
114
|
+
* @param {...any} args - params */
|
115
|
+
err(...args) {
|
116
|
+
const _ = this;
|
117
|
+
const first = args?.[0];
|
118
|
+
if (first instanceof Error || (first?.message && first?.cause && first?.stack))
|
119
|
+
args[0] = {exp: args[0].message};
|
120
|
+
_.error(...args);
|
121
|
+
}
|
125
122
|
}
|
126
123
|
|
127
124
|
/**
|
128
125
|
* get log desc
|
129
126
|
* 描述字符串作为最后参数调用,显示时,前置
|
130
|
-
* @param {*[]} args
|
127
|
+
* @param {*[]} args
|
131
128
|
* @returns {{desc: string, arg: *[]}}
|
132
129
|
*/
|
133
130
|
function getDesc(args) {
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
131
|
+
let desc = '';
|
132
|
+
const last = args.at(-1);
|
133
|
+
if (typeof last === 'string') {
|
134
|
+
desc = last;
|
135
|
+
args.pop();
|
136
|
+
}
|
137
|
+
return {desc, arg: args}
|
141
138
|
}
|
142
139
|
|
143
140
|
/**
|
@@ -147,77 +144,74 @@ function getDesc(args) {
|
|
147
144
|
* returns {*}
|
148
145
|
*/
|
149
146
|
function log(...args) {
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
147
|
+
const last = args.at(-1);
|
148
|
+
|
149
|
+
// 全局日志
|
150
|
+
if (args.length !== 1 || !last?.m) {
|
151
|
+
const desc = getDesc(args);
|
152
|
+
desc ? console.log(desc, ...args) : console.log(...args);
|
153
|
+
return // 退出,不创建实例
|
154
|
+
}
|
155
|
+
|
156
|
+
// 唯一 m 属性,则构造新的 log 实例,这种写法,能被jsDoc识别子属性
|
157
|
+
const lg = new Log(last?.m);
|
158
|
+
/** @param {*} args2 */
|
159
|
+
const R = (...args2) => lg.log(...args2);
|
160
|
+
R.debug = lg.debug.bind(lg);
|
161
|
+
R.info = lg.info.bind(lg);
|
162
|
+
R.warn = lg.warn.bind(lg);
|
163
|
+
R.info = lg.info.bind(lg);
|
164
|
+
R.trace = lg.trace.bind(lg);
|
165
|
+
R.error = lg.error.bind(lg);
|
166
|
+
R.err = lg.err.bind(lg);
|
167
|
+
|
168
|
+
return R
|
172
169
|
}
|
173
170
|
|
174
171
|
/**
|
175
172
|
* 用于 catch(e) log.err(e)
|
176
173
|
* @param {...any} args - params */
|
177
174
|
log.err = (...args) => {
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
)
|
184
|
-
args[0] = { exp: args[0].message };
|
185
|
-
desc ? console.error(desc, ...arg) : console.error(...args);
|
175
|
+
const {desc, arg} = getDesc(args);
|
176
|
+
const first = args?.[0];
|
177
|
+
if (first instanceof Error || (first?.message && first?.cause && first?.stack))
|
178
|
+
args[0] = {exp: args[0].message};
|
179
|
+
desc ? console.error(desc, ...arg) : console.error(...args);
|
186
180
|
};
|
187
181
|
|
188
182
|
/**
|
189
183
|
* @param {...any} args - params */
|
190
184
|
log.error = (...args) => {
|
191
|
-
|
192
|
-
|
185
|
+
const {desc, arg} = getDesc(args);
|
186
|
+
desc ? console.error(desc, ...arg) : console.error(...args);
|
193
187
|
};
|
194
188
|
|
195
189
|
/**
|
196
190
|
* @param {...any} args - params */
|
197
191
|
log.warn = (...args) => {
|
198
|
-
|
199
|
-
|
192
|
+
const {desc, arg} = getDesc(args);
|
193
|
+
desc ? console.warn(desc, ...arg) : console.warn(...args);
|
200
194
|
};
|
201
195
|
|
202
196
|
/**
|
203
197
|
* @param {...any} args - params */
|
204
198
|
log.info = (...args) => {
|
205
|
-
|
206
|
-
|
199
|
+
const {desc, arg} = getDesc(args);
|
200
|
+
desc ? console.info(desc, ...arg) : console.info(...args);
|
207
201
|
};
|
208
202
|
|
209
203
|
/**
|
210
204
|
* @param {...any} args - params */
|
211
205
|
log.debug = (...args) => {
|
212
|
-
|
213
|
-
|
206
|
+
const {desc, arg} = getDesc(args);
|
207
|
+
desc ? console.log(desc, ...arg) : console.log(...args);
|
214
208
|
};
|
215
209
|
|
216
210
|
/**
|
217
211
|
* @param {...any} args - params */
|
218
212
|
log.trace = (...args) => {
|
219
|
-
|
220
|
-
|
213
|
+
const {desc, arg} = getDesc(args);
|
214
|
+
desc ? console.trace(desc, ...arg) : console.trace(...args);
|
221
215
|
};
|
222
216
|
|
223
217
|
export { log as default };
|
package/lib/browser.js
CHANGED
@@ -4,28 +4,33 @@
|
|
4
4
|
* m 为模块,fn 为函数名称
|
5
5
|
*/ let Log = class Log {
|
6
6
|
/**
|
7
|
-
|
8
|
-
|
9
|
-
/** @type {string} 模块 */ this.m =
|
10
|
-
/** @type {string} 函数 */ this.fn =
|
7
|
+
* @param {string} m 模块
|
8
|
+
*/ constructor(m){
|
9
|
+
/** @type {string} 模块 */ this.m = '';
|
10
|
+
/** @type {string} 函数 */ this.fn = '';
|
11
11
|
this.m = m;
|
12
12
|
}
|
13
13
|
/**
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
let R =
|
14
|
+
* get log desc
|
15
|
+
* 描述字符串作为最后参数调用,显示时,前置
|
16
|
+
* @param {*[]} args
|
17
|
+
* @returns {{desc: string, arg: *[]}}
|
18
|
+
*/ getDesc(args) {
|
19
|
+
let R = {
|
20
|
+
desc: '',
|
21
|
+
arg: args
|
22
|
+
};
|
20
23
|
try {
|
21
24
|
const _ = this;
|
22
25
|
const { m } = _;
|
23
|
-
let fn =
|
26
|
+
let fn = '';
|
27
|
+
let desc = '';
|
24
28
|
if (args.length > 1) {
|
25
29
|
const last = args.at(-1);
|
26
|
-
if (typeof last ===
|
30
|
+
if (typeof last === 'object') {
|
31
|
+
;
|
27
32
|
({ desc, fn } = last);
|
28
|
-
} else if (typeof last ===
|
33
|
+
} else if (typeof last === 'string') desc = last;
|
29
34
|
if (desc || fn) {
|
30
35
|
fn = fn || _.fn;
|
31
36
|
_.fn = fn;
|
@@ -33,8 +38,12 @@
|
|
33
38
|
}
|
34
39
|
}
|
35
40
|
fn = fn || _.fn;
|
36
|
-
if (m) desc = `${desc}[${m}${fn ?
|
37
|
-
|
41
|
+
if (m) desc = `${desc}[${m}${fn ? `:${fn}` : ''}]` // eslint-disable-line
|
42
|
+
;
|
43
|
+
R = {
|
44
|
+
desc,
|
45
|
+
arg: args
|
46
|
+
};
|
38
47
|
} catch (e) {
|
39
48
|
console.error(`getDesc exp:${e.message}`);
|
40
49
|
}
|
@@ -44,7 +53,7 @@
|
|
44
53
|
const _ = this;
|
45
54
|
const last = args.at(-1);
|
46
55
|
// clear fn
|
47
|
-
if (args.length === 1 && typeof last ===
|
56
|
+
if (args.length === 1 && typeof last === 'object' && last.fn) _.fn = '';
|
48
57
|
else {
|
49
58
|
const desc = _.getDesc(args);
|
50
59
|
console.log(desc, ...args);
|
@@ -76,29 +85,37 @@
|
|
76
85
|
}
|
77
86
|
/** @param {...any} args - params */ error(...args) {
|
78
87
|
const _ = this;
|
79
|
-
const desc = _.getDesc(args);
|
80
|
-
if (desc) console.error(desc, ...
|
88
|
+
const { desc, arg } = _.getDesc(args);
|
89
|
+
if (desc) console.error(desc, ...arg);
|
81
90
|
else console.log(...args);
|
82
91
|
}
|
83
92
|
/**
|
84
|
-
|
85
|
-
|
93
|
+
* 用于 catch(e) log.err(e)
|
94
|
+
* @param {...any} args - params */ err(...args) {
|
86
95
|
const _ = this;
|
87
96
|
const first = args?.[0];
|
88
|
-
if (first instanceof Error || first
|
97
|
+
if (first instanceof Error || first?.message && first?.cause && first?.stack) args[0] = {
|
89
98
|
exp: args[0].message
|
90
99
|
};
|
91
100
|
_.error(...args);
|
92
101
|
}
|
93
102
|
};
|
94
|
-
|
95
|
-
|
103
|
+
/**
|
104
|
+
* get log desc
|
105
|
+
* 描述字符串作为最后参数调用,显示时,前置
|
106
|
+
* @param {*[]} args
|
107
|
+
* @returns {{desc: string, arg: *[]}}
|
108
|
+
*/ function getDesc(args) {
|
109
|
+
let desc = '';
|
96
110
|
const last = args.at(-1);
|
97
|
-
if (typeof last ===
|
111
|
+
if (typeof last === 'string') {
|
98
112
|
desc = last;
|
99
113
|
args.pop();
|
100
114
|
}
|
101
|
-
return
|
115
|
+
return {
|
116
|
+
desc,
|
117
|
+
arg: args
|
118
|
+
};
|
102
119
|
}
|
103
120
|
/**
|
104
121
|
* 标准日志输出或构建模块日志类实例,用于模块中带[m:xxx]标记日志输出
|
@@ -111,7 +128,7 @@ function getDesc(args) {
|
|
111
128
|
if (args.length !== 1 || !last?.m) {
|
112
129
|
const desc = getDesc(args);
|
113
130
|
desc ? console.log(desc, ...args) : console.log(...args);
|
114
|
-
return;
|
131
|
+
return; // 退出,不创建实例
|
115
132
|
}
|
116
133
|
// 唯一 m 属性,则构造新的 log 实例,这种写法,能被jsDoc识别子属性
|
117
134
|
const lg = new Log(last?.m);
|
@@ -128,49 +145,36 @@ function getDesc(args) {
|
|
128
145
|
/**
|
129
146
|
* 用于 catch(e) log.err(e)
|
130
147
|
* @param {...any} args - params */ log.err = (...args)=>{
|
131
|
-
const desc = getDesc(args);
|
148
|
+
const { desc, arg } = getDesc(args);
|
132
149
|
const first = args?.[0];
|
133
|
-
if (first instanceof Error || first
|
150
|
+
if (first instanceof Error || first?.message && first?.cause && first?.stack) args[0] = {
|
134
151
|
exp: args[0].message
|
135
152
|
};
|
136
|
-
desc ? console.error(desc, ...
|
153
|
+
desc ? console.error(desc, ...arg) : console.error(...args);
|
137
154
|
};
|
138
155
|
/**
|
139
156
|
* @param {...any} args - params */ log.error = (...args)=>{
|
140
|
-
const desc = getDesc(args);
|
141
|
-
desc ? console.error(desc, ...
|
157
|
+
const { desc, arg } = getDesc(args);
|
158
|
+
desc ? console.error(desc, ...arg) : console.error(...args);
|
142
159
|
};
|
143
160
|
/**
|
144
161
|
* @param {...any} args - params */ log.warn = (...args)=>{
|
145
|
-
const desc = getDesc(args);
|
146
|
-
desc ? console.warn(desc, ...
|
162
|
+
const { desc, arg } = getDesc(args);
|
163
|
+
desc ? console.warn(desc, ...arg) : console.warn(...args);
|
147
164
|
};
|
148
165
|
/**
|
149
166
|
* @param {...any} args - params */ log.info = (...args)=>{
|
150
|
-
const desc = getDesc(args);
|
151
|
-
desc ? console.info(desc, ...
|
167
|
+
const { desc, arg } = getDesc(args);
|
168
|
+
desc ? console.info(desc, ...arg) : console.info(...args);
|
152
169
|
};
|
153
170
|
/**
|
154
171
|
* @param {...any} args - params */ log.debug = (...args)=>{
|
155
|
-
const desc = getDesc(args);
|
156
|
-
desc ? console.log(desc, ...
|
172
|
+
const { desc, arg } = getDesc(args);
|
173
|
+
desc ? console.log(desc, ...arg) : console.log(...args);
|
157
174
|
};
|
158
175
|
/**
|
159
176
|
* @param {...any} args - params */ log.trace = (...args)=>{
|
160
|
-
const desc = getDesc(args);
|
161
|
-
desc ? console.trace(desc, ...
|
177
|
+
const { desc, arg } = getDesc(args);
|
178
|
+
desc ? console.trace(desc, ...arg) : console.trace(...args);
|
162
179
|
};
|
163
|
-
|
164
|
-
* 获取模块文件名称
|
165
|
-
* esm: import.meta.url or cjs: __filename
|
166
|
-
* @param {string} file
|
167
|
-
* @returns
|
168
|
-
*/ function name(file) {
|
169
|
-
// import.meta.url: 'file:///D:/prj/wiajs/req/test/log.t.js'
|
170
|
-
// file = fileURLToPath(file) // fileUrl 转成路径
|
171
|
-
// const baseName = path.basename(file)
|
172
|
-
// return baseName.replace(path.extname(baseName), '')
|
173
|
-
return '';
|
174
|
-
}
|
175
|
-
export { name, log }; // export default log;
|
176
|
-
// export { log, Log };
|
180
|
+
export default log;
|
package/lib/node.js
CHANGED
@@ -23,17 +23,17 @@ import debug from 'debug';
|
|
23
23
|
*/ constructor(opts){
|
24
24
|
let { env } = opts;
|
25
25
|
env = env ?? '';
|
26
|
-
const
|
26
|
+
const dgs = {} // debugs
|
27
27
|
;
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
dgs.debug = debug(`${env}`);
|
29
|
+
dgs.info = debug(`${env}:info`);
|
30
|
+
dgs.err = debug(`${env}:err`);
|
31
|
+
dgs.warn = debug(`${env}:warn`);
|
32
32
|
// 仅最后调用生效,覆盖环境变量
|
33
|
-
if (
|
34
|
-
else if (
|
33
|
+
if (dgs.debug.enabled) debug.enable('*');
|
34
|
+
else if (dgs.info.enabled) debug.enable(`${env}:info,${env}:err,${env}:warn`);
|
35
35
|
else debug.enable(`${env}:err,${env}:warn`);
|
36
|
-
this.
|
36
|
+
this.dgs = dgs;
|
37
37
|
}
|
38
38
|
/**
|
39
39
|
*
|
@@ -42,9 +42,9 @@ import debug from 'debug';
|
|
42
42
|
const first = args?.at(0);
|
43
43
|
const last = args?.at(-1);
|
44
44
|
if (typeof first === 'string') {
|
45
|
-
args
|
46
|
-
this.
|
47
|
-
} else if (typeof first === 'object' && typeof last === 'string') this.
|
45
|
+
args.shift();
|
46
|
+
this.dgs.debug(first, ...args);
|
47
|
+
} else if (typeof first === 'object' && typeof last === 'string') this.dgs.debug(`${last}:%O`, first);
|
48
48
|
// args[0] = `${this.pre}:${args[0]}`
|
49
49
|
// console.debug(...args)
|
50
50
|
// console.debug(this.pre, ...args)
|
@@ -56,9 +56,9 @@ import debug from 'debug';
|
|
56
56
|
const first = args?.at(0);
|
57
57
|
const last = args?.at(-1);
|
58
58
|
if (typeof first === 'string') {
|
59
|
-
args
|
60
|
-
this.
|
61
|
-
} else if (typeof first === 'object' && typeof last === 'string') this.
|
59
|
+
args.shift();
|
60
|
+
this.dgs.err(` ${first}`, ...args);
|
61
|
+
} else if (typeof first === 'object' && typeof last === 'string') this.dgs.err(` ${last}:%O`, first);
|
62
62
|
}
|
63
63
|
/**
|
64
64
|
*
|
@@ -79,8 +79,10 @@ import debug from 'debug';
|
|
79
79
|
*/ warn(...args) {
|
80
80
|
const first = args?.at(0);
|
81
81
|
const last = args?.at(-1);
|
82
|
-
if (typeof first === 'string')
|
83
|
-
|
82
|
+
if (typeof first === 'string') {
|
83
|
+
args.shift();
|
84
|
+
this.dgs.warn(first, ...args);
|
85
|
+
} else if (typeof first === 'object' && typeof last === 'string') this.dgs.warn(`${last}:%O`, first);
|
84
86
|
}
|
85
87
|
/**
|
86
88
|
*
|
@@ -88,8 +90,12 @@ import debug from 'debug';
|
|
88
90
|
*/ info(...args) {
|
89
91
|
const first = args?.at(0);
|
90
92
|
const last = args?.at(-1);
|
91
|
-
|
92
|
-
|
93
|
+
// const dg = debug('ab')
|
94
|
+
// dg()
|
95
|
+
if (typeof first === 'string') {
|
96
|
+
args.shift();
|
97
|
+
this.dgs.info(first, ...args);
|
98
|
+
} else if (typeof first === 'object' && typeof last === 'string') this.dgs.info(`${last}:%O`, first);
|
93
99
|
}
|
94
100
|
}
|
95
101
|
/**
|