@zwa73/utils 1.0.31 → 1.0.33
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/dist/UtilCom.js +1 -2
- package/dist/UtilLogger.d.ts +31 -0
- package/dist/UtilLogger.js +95 -6
- package/package.json +1 -1
- package/src/UtilCom.ts +2 -2
- package/src/UtilLogger.ts +115 -6
- package/test.js +8 -2
- package/testlog/log-2023-08-21.txt +304 -0
package/dist/UtilCom.js
CHANGED
|
@@ -5,7 +5,6 @@ const UtilInterfaces_1 = require("./UtilInterfaces");
|
|
|
5
5
|
const https = require("https");
|
|
6
6
|
const http = require("http");
|
|
7
7
|
const UtilLogger_1 = require("./UtilLogger");
|
|
8
|
-
const util_1 = require("util");
|
|
9
8
|
function sPost(type, json, options, timeLimit = -1) {
|
|
10
9
|
//转换为毫秒
|
|
11
10
|
const hasTimeLimit = (timeLimit >= 10);
|
|
@@ -34,7 +33,7 @@ function sPost(type, json, options, timeLimit = -1) {
|
|
|
34
33
|
throw funcName + " 接收反馈错误: resdata 为空";
|
|
35
34
|
try {
|
|
36
35
|
let obj = JSON.parse(resdata);
|
|
37
|
-
UtilLogger_1.SLogger.http(funcName + " 接受信息:", (0,
|
|
36
|
+
UtilLogger_1.SLogger.http(funcName + " 接受信息:", (0, UtilInterfaces_1.stringifyJToken)(obj));
|
|
38
37
|
resolve(obj);
|
|
39
38
|
return;
|
|
40
39
|
}
|
package/dist/UtilLogger.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**hrtime所产生的的记录 */
|
|
2
|
+
export type HRTimeLog = {
|
|
3
|
+
/**秒数 */
|
|
4
|
+
0: number;
|
|
5
|
+
/**纳秒数 */
|
|
6
|
+
1: number;
|
|
7
|
+
};
|
|
1
8
|
/**log等级 undefined相当于 silly */
|
|
2
9
|
export type LogLevel = "fatal" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
3
10
|
export declare class SLogger {
|
|
@@ -18,6 +25,8 @@ export declare class SLogger {
|
|
|
18
25
|
private _logger;
|
|
19
26
|
/**记录Logger的表 */
|
|
20
27
|
private static readonly loggerTable;
|
|
28
|
+
/**记录Logger的表 */
|
|
29
|
+
private static readonly timeTable;
|
|
21
30
|
/**产生一条对应等级的log 返回自身
|
|
22
31
|
* @param {LogLevel} level - log等级
|
|
23
32
|
* @param {Array<any>} messages - log消息
|
|
@@ -64,6 +73,17 @@ export declare class SLogger {
|
|
|
64
73
|
* @returns {SLogger} - 自身
|
|
65
74
|
*/
|
|
66
75
|
silly(...messages: Array<any>): SLogger;
|
|
76
|
+
/**记录当前时间戳并存入表
|
|
77
|
+
* @param {string} flag - 记录的命名
|
|
78
|
+
* @returns {HRTimeLog} - 记录的时间
|
|
79
|
+
*/
|
|
80
|
+
time(flag: string): HRTimeLog;
|
|
81
|
+
/**根据之前记录的时间戳计算经过的时间 并输出log
|
|
82
|
+
* @param {string} flag - 记录的命名
|
|
83
|
+
* @param {LogLevel|null} level - log等级 ===null时不产生log
|
|
84
|
+
* @returns {string|null} - 格式化的时间字符串
|
|
85
|
+
*/
|
|
86
|
+
timeEnd(flag: string, level?: LogLevel | null): string | null;
|
|
67
87
|
/**名称为default的slogger实例 */
|
|
68
88
|
private static get defaultInstance();
|
|
69
89
|
/**让名称为default的logger 产生一条对应等级的log 返回自身
|
|
@@ -112,4 +132,15 @@ export declare class SLogger {
|
|
|
112
132
|
* @returns {SLogger} - 自身
|
|
113
133
|
*/
|
|
114
134
|
static silly(...messages: Array<any>): SLogger;
|
|
135
|
+
/**让名称为default的logger 记录当前时间戳并存入表
|
|
136
|
+
* @param {string} flag - 记录的命名
|
|
137
|
+
* @returns {HRTimeLog} - 记录的时间
|
|
138
|
+
*/
|
|
139
|
+
static time(flag: string): HRTimeLog;
|
|
140
|
+
/**让名称为default的logger 根据之前记录的时间戳计算经过的时间 并输出log
|
|
141
|
+
* @param {string} flag - 记录的命名
|
|
142
|
+
* @param {LogLevel} level - log等级
|
|
143
|
+
* @returns {void}
|
|
144
|
+
*/
|
|
145
|
+
static timeEnd(flag: string, level?: LogLevel): void;
|
|
115
146
|
}
|
package/dist/UtilLogger.js
CHANGED
|
@@ -51,10 +51,10 @@ class SLogger {
|
|
|
51
51
|
const level = info.level.toUpperCase();
|
|
52
52
|
const message = info.message;
|
|
53
53
|
//格式化
|
|
54
|
-
let format = `[${info.timestamp}] [${level}]:
|
|
55
|
-
let space = " ".repeat(format.length);
|
|
54
|
+
//let format = `[${info.timestamp}] [${level}]: `
|
|
55
|
+
//let space = " ".repeat(format.length);
|
|
56
56
|
let messageList = message.split("\n");
|
|
57
|
-
return `[${info.timestamp}] [${level.toUpperCase()}]: ${messageList.join("\n"
|
|
57
|
+
return `[${info.timestamp}] [${level.toUpperCase()}]: ${messageList.join("\n")}`;
|
|
58
58
|
}));
|
|
59
59
|
transports.push(new DailyRotateFile({
|
|
60
60
|
filename: path.join(outFloder, 'log-%DATE%.txt'),
|
|
@@ -68,13 +68,13 @@ class SLogger {
|
|
|
68
68
|
const message = info.message;
|
|
69
69
|
const colorizedLevel = colorizer.colorize(info.level, level);
|
|
70
70
|
//格式化
|
|
71
|
-
let format = `[${info.timestamp}] [${level}]:
|
|
72
|
-
let space = " ".repeat(format.length);
|
|
71
|
+
//let format = `[${info.timestamp}] [${level}]: `
|
|
72
|
+
//let space = " ".repeat(format.length);
|
|
73
73
|
let messageList = message.split("\n");
|
|
74
74
|
messageList[0] = colorizer.colorize(info.level, messageList[0]);
|
|
75
75
|
for (let i = 1; i < messageList.length; i++)
|
|
76
76
|
messageList[i] = colorizer.colorize(info.level, messageList[i]);
|
|
77
|
-
return `[${info.timestamp}] [${colorizedLevel}]: ${messageList.join("\n"
|
|
77
|
+
return `[${info.timestamp}] [${colorizedLevel}]: ${messageList.join("\n")}`;
|
|
78
78
|
}));
|
|
79
79
|
transports.push(new winston.transports.Console({
|
|
80
80
|
level: consoleLevel,
|
|
@@ -100,6 +100,8 @@ class SLogger {
|
|
|
100
100
|
_logger = null;
|
|
101
101
|
/**记录Logger的表 */
|
|
102
102
|
static loggerTable = {};
|
|
103
|
+
/**记录Logger的表 */
|
|
104
|
+
static timeTable = {};
|
|
103
105
|
//———————————————————— function ——————————————————————//
|
|
104
106
|
/**产生一条对应等级的log 返回自身
|
|
105
107
|
* @param {LogLevel} level - log等级
|
|
@@ -182,6 +184,78 @@ class SLogger {
|
|
|
182
184
|
silly(...messages) {
|
|
183
185
|
return this.log("silly", ...messages);
|
|
184
186
|
}
|
|
187
|
+
/**记录当前时间戳并存入表
|
|
188
|
+
* @param {string} flag - 记录的命名
|
|
189
|
+
* @returns {HRTimeLog} - 记录的时间
|
|
190
|
+
*/
|
|
191
|
+
time(flag) {
|
|
192
|
+
let hrtime = process.hrtime();
|
|
193
|
+
SLogger.timeTable[flag] = hrtime;
|
|
194
|
+
return hrtime;
|
|
195
|
+
}
|
|
196
|
+
/**根据之前记录的时间戳计算经过的时间 并输出log
|
|
197
|
+
* @param {string} flag - 记录的命名
|
|
198
|
+
* @param {LogLevel|null} level - log等级 ===null时不产生log
|
|
199
|
+
* @returns {string|null} - 格式化的时间字符串
|
|
200
|
+
*/
|
|
201
|
+
timeEnd(flag, level = "info") {
|
|
202
|
+
let start = SLogger.timeTable[flag];
|
|
203
|
+
if (start == null) {
|
|
204
|
+
this.warn("SLogger.timeEnd 错误 flag:" + flag + " 不存在");
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
const timelen = process.hrtime(start);
|
|
208
|
+
const totalMicroseconds = (timelen[0] * 1e9 + timelen[1]) / 1000;
|
|
209
|
+
const microseconds = totalMicroseconds % 1000;
|
|
210
|
+
const totalMilliseconds = totalMicroseconds / 1000;
|
|
211
|
+
const milliseconds = Math.floor(totalMilliseconds % 1000);
|
|
212
|
+
const totalSeconds = totalMilliseconds / 1000;
|
|
213
|
+
const seconds = Math.floor(totalSeconds % 60);
|
|
214
|
+
const totalMinutes = totalSeconds / 60;
|
|
215
|
+
const minutes = Math.floor(totalMinutes % 60);
|
|
216
|
+
const totalHours = totalMinutes / 60;
|
|
217
|
+
const hours = Math.floor(totalHours % 24);
|
|
218
|
+
const totalDay = totalHours / 24;
|
|
219
|
+
const Days = Math.floor(totalDay);
|
|
220
|
+
let out = '';
|
|
221
|
+
if (totalSeconds > 60) {
|
|
222
|
+
let result = '';
|
|
223
|
+
let format = '';
|
|
224
|
+
let acc = 0;
|
|
225
|
+
const maxAcc = 3;
|
|
226
|
+
let concat = function (num, sep, formatText, resultText) {
|
|
227
|
+
let hasResult = result.length > 0;
|
|
228
|
+
let need = (hasResult || num > 0) && (acc < maxAcc);
|
|
229
|
+
if (need) {
|
|
230
|
+
if (result.length > 0)
|
|
231
|
+
result += sep;
|
|
232
|
+
if (format.length > 0)
|
|
233
|
+
format += sep;
|
|
234
|
+
result += resultText;
|
|
235
|
+
format += formatText;
|
|
236
|
+
acc++;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
concat(Days, ':', 'dd', `${Days.toString()}`);
|
|
240
|
+
concat(hours, ':', 'HH', `${hours.toString().padStart(2, '0')}`);
|
|
241
|
+
concat(minutes, ':', 'mm', `${minutes.toString().padStart(2, '0')}`);
|
|
242
|
+
concat(seconds, ':', 'ss', `${seconds.toString().padStart(2, '0')}`);
|
|
243
|
+
concat(milliseconds, '.', 'mmm', `${milliseconds.toString().padStart(3, '0')}`);
|
|
244
|
+
//result = result.replace(/^(0(?![^0-9]))+/, '');
|
|
245
|
+
result = result.replace(/^0+([0-9])/, "$1");
|
|
246
|
+
out = `${result} (${format})`;
|
|
247
|
+
}
|
|
248
|
+
else if (totalMilliseconds > 1000) {
|
|
249
|
+
out = `${totalSeconds.toFixed(3)}s`;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
out = `${totalMilliseconds.toFixed(3)}ms`;
|
|
253
|
+
}
|
|
254
|
+
if (level !== null)
|
|
255
|
+
this.log(level, flag + ": " + out);
|
|
256
|
+
delete SLogger.timeTable[flag];
|
|
257
|
+
return out;
|
|
258
|
+
}
|
|
185
259
|
//———————————————————— static ——————————————————————//
|
|
186
260
|
/**名称为default的slogger实例 */
|
|
187
261
|
static get defaultInstance() {
|
|
@@ -258,5 +332,20 @@ class SLogger {
|
|
|
258
332
|
static silly(...messages) {
|
|
259
333
|
return this.log("silly", ...messages);
|
|
260
334
|
}
|
|
335
|
+
/**让名称为default的logger 记录当前时间戳并存入表
|
|
336
|
+
* @param {string} flag - 记录的命名
|
|
337
|
+
* @returns {HRTimeLog} - 记录的时间
|
|
338
|
+
*/
|
|
339
|
+
static time(flag) {
|
|
340
|
+
return this.defaultInstance.time(flag);
|
|
341
|
+
}
|
|
342
|
+
/**让名称为default的logger 根据之前记录的时间戳计算经过的时间 并输出log
|
|
343
|
+
* @param {string} flag - 记录的命名
|
|
344
|
+
* @param {LogLevel} level - log等级
|
|
345
|
+
* @returns {void}
|
|
346
|
+
*/
|
|
347
|
+
static timeEnd(flag, level = "info") {
|
|
348
|
+
this.defaultInstance.timeEnd(flag, level);
|
|
349
|
+
}
|
|
261
350
|
}
|
|
262
351
|
exports.SLogger = SLogger;
|
package/package.json
CHANGED
package/src/UtilCom.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { JObject, stringifyJToken } from "./UtilInterfaces";
|
|
|
2
2
|
import * as https from 'https';
|
|
3
3
|
import * as http from 'http';
|
|
4
4
|
import { SLogger } from "./UtilLogger";
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
function sPost(type:"http"|"https",json:JObject,options:Object,timeLimit:number=-1):Promise<JObject|null>{
|
|
@@ -38,7 +38,7 @@ function sPost(type:"http"|"https",json:JObject,options:Object,timeLimit:number=
|
|
|
38
38
|
throw funcName+" 接收反馈错误: resdata 为空";
|
|
39
39
|
try{
|
|
40
40
|
let obj = JSON.parse(resdata);
|
|
41
|
-
SLogger.http(funcName+" 接受信息:",
|
|
41
|
+
SLogger.http(funcName+" 接受信息:",stringifyJToken(obj));
|
|
42
42
|
resolve(obj);
|
|
43
43
|
return;
|
|
44
44
|
}
|
package/src/UtilLogger.ts
CHANGED
|
@@ -4,6 +4,15 @@ import * as DailyRotateFile from 'winston-daily-rotate-file';
|
|
|
4
4
|
import {inspect} from 'util';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
|
|
8
|
+
/**hrtime所产生的的记录 */
|
|
9
|
+
export type HRTimeLog = {
|
|
10
|
+
/**秒数 */
|
|
11
|
+
0:number;
|
|
12
|
+
/**纳秒数 */
|
|
13
|
+
1:number;
|
|
14
|
+
};
|
|
15
|
+
|
|
7
16
|
/**log等级 undefined相当于 silly */
|
|
8
17
|
export type LogLevel = "fatal"|"error"|"warn"|"info"|"http"|"verbose"|"debug"|"silly"|undefined;
|
|
9
18
|
const logLevels = {
|
|
@@ -56,10 +65,10 @@ export class SLogger{
|
|
|
56
65
|
const level = info.level.toUpperCase();
|
|
57
66
|
const message = info.message as string;
|
|
58
67
|
//格式化
|
|
59
|
-
let format = `[${info.timestamp}] [${level}]: `
|
|
60
|
-
let space = " ".repeat(format.length);
|
|
68
|
+
//let format = `[${info.timestamp}] [${level}]: `
|
|
69
|
+
//let space = " ".repeat(format.length);
|
|
61
70
|
let messageList = message.split("\n");
|
|
62
|
-
return `[${info.timestamp}] [${level.toUpperCase()}]: ${messageList.join("\n"
|
|
71
|
+
return `[${info.timestamp}] [${level.toUpperCase()}]: ${messageList.join("\n")}`
|
|
63
72
|
}),
|
|
64
73
|
);
|
|
65
74
|
transports.push(new DailyRotateFile({
|
|
@@ -76,13 +85,13 @@ export class SLogger{
|
|
|
76
85
|
const message = info.message as string;
|
|
77
86
|
const colorizedLevel = colorizer.colorize(info.level, level);
|
|
78
87
|
//格式化
|
|
79
|
-
let format = `[${info.timestamp}] [${level}]: `
|
|
80
|
-
let space = " ".repeat(format.length);
|
|
88
|
+
//let format = `[${info.timestamp}] [${level}]: `
|
|
89
|
+
//let space = " ".repeat(format.length);
|
|
81
90
|
let messageList = message.split("\n");
|
|
82
91
|
messageList[0]=colorizer.colorize(info.level, messageList[0])
|
|
83
92
|
for(let i=1;i<messageList.length;i++)
|
|
84
93
|
messageList[i]=colorizer.colorize(info.level, messageList[i]);
|
|
85
|
-
return `[${info.timestamp}] [${colorizedLevel}]: ${messageList.join("\n"
|
|
94
|
+
return `[${info.timestamp}] [${colorizedLevel}]: ${messageList.join("\n")}`;
|
|
86
95
|
}),
|
|
87
96
|
);
|
|
88
97
|
transports.push(new winston.transports.Console({
|
|
@@ -111,6 +120,8 @@ export class SLogger{
|
|
|
111
120
|
private _logger:winston.Logger = null as any as winston.Logger;
|
|
112
121
|
/**记录Logger的表 */
|
|
113
122
|
private static readonly loggerTable:Record<string,SLogger> = {};
|
|
123
|
+
/**记录Logger的表 */
|
|
124
|
+
private static readonly timeTable:Record<string,HRTimeLog> = {};
|
|
114
125
|
|
|
115
126
|
|
|
116
127
|
|
|
@@ -192,6 +203,89 @@ export class SLogger{
|
|
|
192
203
|
silly(...messages:Array<any>):SLogger {
|
|
193
204
|
return this.log("silly",...messages);
|
|
194
205
|
}
|
|
206
|
+
/**记录当前时间戳并存入表
|
|
207
|
+
* @param {string} flag - 记录的命名
|
|
208
|
+
* @returns {HRTimeLog} - 记录的时间
|
|
209
|
+
*/
|
|
210
|
+
time(flag:string):HRTimeLog{
|
|
211
|
+
let hrtime = process.hrtime();
|
|
212
|
+
SLogger.timeTable[flag]=hrtime;
|
|
213
|
+
return hrtime;
|
|
214
|
+
}
|
|
215
|
+
/**根据之前记录的时间戳计算经过的时间 并输出log
|
|
216
|
+
* @param {string} flag - 记录的命名
|
|
217
|
+
* @param {LogLevel|null} level - log等级 ===null时不产生log
|
|
218
|
+
* @returns {string|null} - 格式化的时间字符串
|
|
219
|
+
*/
|
|
220
|
+
timeEnd(flag:string,level:LogLevel|null="info"):string|null{
|
|
221
|
+
let start = SLogger.timeTable[flag];
|
|
222
|
+
if(start==null){
|
|
223
|
+
this.warn("SLogger.timeEnd 错误 flag:"+flag+" 不存在");
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
const timelen = process.hrtime(start as any as [number,number]);
|
|
227
|
+
|
|
228
|
+
const totalMicroseconds = (timelen[0] * 1e9 + timelen[1]) / 1000;
|
|
229
|
+
const microseconds = totalMicroseconds % 1000;
|
|
230
|
+
const totalMilliseconds = totalMicroseconds / 1000;
|
|
231
|
+
const milliseconds = Math.floor(totalMilliseconds % 1000);
|
|
232
|
+
const totalSeconds = totalMilliseconds / 1000;
|
|
233
|
+
const seconds = Math.floor(totalSeconds % 60);
|
|
234
|
+
const totalMinutes = totalSeconds / 60;
|
|
235
|
+
const minutes = Math.floor(totalMinutes % 60);
|
|
236
|
+
const totalHours = totalMinutes / 60;
|
|
237
|
+
const hours = Math.floor(totalHours % 24);
|
|
238
|
+
const totalDay = totalHours / 24;
|
|
239
|
+
const Days = Math.floor(totalDay);
|
|
240
|
+
|
|
241
|
+
let out = '';
|
|
242
|
+
if(totalSeconds>60){
|
|
243
|
+
let result = '';
|
|
244
|
+
let format = '';
|
|
245
|
+
let acc = 0;
|
|
246
|
+
const maxAcc = 3;
|
|
247
|
+
|
|
248
|
+
let concat = function(num:number,sep:string,
|
|
249
|
+
formatText:string,resultText:string):void{
|
|
250
|
+
let hasResult = result.length>0;
|
|
251
|
+
let need = (hasResult || num>0) && (acc < maxAcc);
|
|
252
|
+
if(need){
|
|
253
|
+
if(result.length>0) result+=sep;
|
|
254
|
+
if(format.length>0) format+=sep;
|
|
255
|
+
result += resultText;
|
|
256
|
+
format += formatText;
|
|
257
|
+
acc++;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
concat(Days,':','dd',
|
|
261
|
+
`${Days.toString()}`,
|
|
262
|
+
);
|
|
263
|
+
concat(hours,':','HH',
|
|
264
|
+
`${hours.toString().padStart(2, '0')}`
|
|
265
|
+
);
|
|
266
|
+
concat(minutes,':','mm',
|
|
267
|
+
`${minutes.toString().padStart(2, '0')}`
|
|
268
|
+
);
|
|
269
|
+
concat(seconds,':','ss',
|
|
270
|
+
`${seconds.toString().padStart(2, '0')}`
|
|
271
|
+
);
|
|
272
|
+
concat(milliseconds,'.','mmm',
|
|
273
|
+
`${milliseconds.toString().padStart(3, '0')}`
|
|
274
|
+
);
|
|
275
|
+
//result = result.replace(/^(0(?![^0-9]))+/, '');
|
|
276
|
+
result = result.replace(/^0+([0-9])/,"$1");
|
|
277
|
+
out = `${result} (${format})`;
|
|
278
|
+
}else if(totalMilliseconds>1000){
|
|
279
|
+
out = `${totalSeconds.toFixed(3)}s`
|
|
280
|
+
}else{
|
|
281
|
+
out = `${totalMilliseconds.toFixed(3)}ms`
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if(level!==null)
|
|
285
|
+
this.log(level,flag+": "+out);
|
|
286
|
+
delete SLogger.timeTable[flag];
|
|
287
|
+
return out;
|
|
288
|
+
}
|
|
195
289
|
|
|
196
290
|
|
|
197
291
|
|
|
@@ -268,6 +362,21 @@ export class SLogger{
|
|
|
268
362
|
static silly(...messages:Array<any>):SLogger {
|
|
269
363
|
return this.log("silly",...messages);
|
|
270
364
|
}
|
|
365
|
+
/**让名称为default的logger 记录当前时间戳并存入表
|
|
366
|
+
* @param {string} flag - 记录的命名
|
|
367
|
+
* @returns {HRTimeLog} - 记录的时间
|
|
368
|
+
*/
|
|
369
|
+
static time(flag:string):HRTimeLog{
|
|
370
|
+
return this.defaultInstance.time(flag);
|
|
371
|
+
}
|
|
372
|
+
/**让名称为default的logger 根据之前记录的时间戳计算经过的时间 并输出log
|
|
373
|
+
* @param {string} flag - 记录的命名
|
|
374
|
+
* @param {LogLevel} level - log等级
|
|
375
|
+
* @returns {void}
|
|
376
|
+
*/
|
|
377
|
+
static timeEnd(flag:string,level:LogLevel="info"):void{
|
|
378
|
+
this.defaultInstance.timeEnd(flag,level);
|
|
379
|
+
}
|
|
271
380
|
}
|
|
272
381
|
|
|
273
382
|
|
package/test.js
CHANGED
|
@@ -15,9 +15,13 @@ for(let {key,value} of map)
|
|
|
15
15
|
async function main(){
|
|
16
16
|
//SFfmpegTool.setFfmpegPath("E:/系统工具/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe");
|
|
17
17
|
//console.log(111111111111)
|
|
18
|
-
|
|
18
|
+
let timelog = SLogger.time("timetest0")
|
|
19
|
+
timelog[0]=process.hrtime()[0]-1000;
|
|
20
|
+
SLogger.timeEnd("timetest0")
|
|
21
|
+
SLogger.time("timetest")
|
|
22
|
+
let data = await SFfmpegTool.getAudioMetaData("input.wav");
|
|
19
23
|
//console.log(22)
|
|
20
|
-
|
|
24
|
+
console.log(data);
|
|
21
25
|
//
|
|
22
26
|
//let fileMap = fileSearch("F:/Sosarciel/SoulTide-Collection-VITS-TrainingSet/TrainingSet/Akaset/sliced_audio",'.*\\.wav');
|
|
23
27
|
//let ioMap = {};
|
|
@@ -27,6 +31,8 @@ async function main(){
|
|
|
27
31
|
//}
|
|
28
32
|
//console.log(ioMap)
|
|
29
33
|
//await SFfmpegTool.resampleMP(ioMap)
|
|
34
|
+
await sleep(2000);
|
|
35
|
+
SLogger.timeEnd("timetest")
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
main();
|
|
@@ -91,3 +91,307 @@
|
|
|
91
91
|
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
92
92
|
'11111'
|
|
93
93
|
}
|
|
94
|
+
[22:55:44] [FATAL]: This is an fatal message
|
|
95
|
+
[22:55:44] [ERROR]: This is an error message
|
|
96
|
+
[22:55:44] [WARN]: This is a warning message
|
|
97
|
+
[22:55:44] [INFO]: This is an info message
|
|
98
|
+
[22:55:44] [HTTP]: This is an http message
|
|
99
|
+
[22:55:44] [VERBOSE]: This is a verbose message
|
|
100
|
+
[22:55:44] [DEBUG]: This is a debug message
|
|
101
|
+
[22:55:44] [SILLY]: This is a silly message
|
|
102
|
+
[22:55:44] [FATAL]: This is an info message
|
|
103
|
+
<number> 123
|
|
104
|
+
<boolean> true
|
|
105
|
+
[22:55:44] [INFO]: <object> {
|
|
106
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
107
|
+
'11111'
|
|
108
|
+
}
|
|
109
|
+
[22:55:44] [INFO]: timetest: 184h15m46s
|
|
110
|
+
[22:57:39] [FATAL]: This is an fatal message
|
|
111
|
+
[22:57:39] [ERROR]: This is an error message
|
|
112
|
+
[22:57:39] [WARN]: This is a warning message
|
|
113
|
+
[22:57:39] [INFO]: This is an info message
|
|
114
|
+
[22:57:39] [HTTP]: This is an http message
|
|
115
|
+
[22:57:39] [VERBOSE]: This is a verbose message
|
|
116
|
+
[22:57:39] [DEBUG]: This is a debug message
|
|
117
|
+
[22:57:39] [SILLY]: This is a silly message
|
|
118
|
+
[22:57:39] [FATAL]: This is an info message
|
|
119
|
+
<number> 123
|
|
120
|
+
<boolean> true
|
|
121
|
+
[22:57:39] [INFO]: <object> {
|
|
122
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
123
|
+
'11111'
|
|
124
|
+
}
|
|
125
|
+
[22:57:39] [INFO]: timetest: 184h17m40s
|
|
126
|
+
[22:57:44] [FATAL]: This is an fatal message
|
|
127
|
+
[22:57:44] [ERROR]: This is an error message
|
|
128
|
+
[22:57:44] [WARN]: This is a warning message
|
|
129
|
+
[22:57:44] [INFO]: This is an info message
|
|
130
|
+
[22:57:44] [HTTP]: This is an http message
|
|
131
|
+
[22:57:44] [VERBOSE]: This is a verbose message
|
|
132
|
+
[22:57:44] [DEBUG]: This is a debug message
|
|
133
|
+
[22:57:44] [SILLY]: This is a silly message
|
|
134
|
+
[22:57:44] [FATAL]: This is an info message
|
|
135
|
+
<number> 123
|
|
136
|
+
<boolean> true
|
|
137
|
+
[22:57:44] [INFO]: <object> {
|
|
138
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
139
|
+
'11111'
|
|
140
|
+
}
|
|
141
|
+
[22:57:44] [INFO]: timetest: 184h17m45s
|
|
142
|
+
[22:57:47] [FATAL]: This is an fatal message
|
|
143
|
+
[22:57:47] [ERROR]: This is an error message
|
|
144
|
+
[22:57:47] [WARN]: This is a warning message
|
|
145
|
+
[22:57:47] [INFO]: This is an info message
|
|
146
|
+
[22:57:47] [HTTP]: This is an http message
|
|
147
|
+
[22:57:47] [VERBOSE]: This is a verbose message
|
|
148
|
+
[22:57:47] [DEBUG]: This is a debug message
|
|
149
|
+
[22:57:47] [SILLY]: This is a silly message
|
|
150
|
+
[22:57:47] [FATAL]: This is an info message
|
|
151
|
+
<number> 123
|
|
152
|
+
<boolean> true
|
|
153
|
+
[22:57:47] [INFO]: <object> {
|
|
154
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
155
|
+
'11111'
|
|
156
|
+
}
|
|
157
|
+
[22:57:47] [INFO]: timetest: 184h17m49s
|
|
158
|
+
[22:59:34] [FATAL]: This is an fatal message
|
|
159
|
+
[22:59:34] [ERROR]: This is an error message
|
|
160
|
+
[22:59:34] [WARN]: This is a warning message
|
|
161
|
+
[22:59:34] [INFO]: This is an info message
|
|
162
|
+
[22:59:34] [HTTP]: This is an http message
|
|
163
|
+
[22:59:34] [VERBOSE]: This is a verbose message
|
|
164
|
+
[22:59:34] [DEBUG]: This is a debug message
|
|
165
|
+
[22:59:34] [SILLY]: This is a silly message
|
|
166
|
+
[22:59:34] [FATAL]: This is an info message
|
|
167
|
+
<number> 123
|
|
168
|
+
<boolean> true
|
|
169
|
+
[22:59:34] [INFO]: <object> {
|
|
170
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
171
|
+
'11111'
|
|
172
|
+
}
|
|
173
|
+
[22:59:34] [INFO]: timetest: 175.800us
|
|
174
|
+
[22:59:58] [FATAL]: This is an fatal message
|
|
175
|
+
[22:59:58] [ERROR]: This is an error message
|
|
176
|
+
[22:59:58] [WARN]: This is a warning message
|
|
177
|
+
[22:59:58] [INFO]: This is an info message
|
|
178
|
+
[22:59:58] [HTTP]: This is an http message
|
|
179
|
+
[22:59:58] [VERBOSE]: This is a verbose message
|
|
180
|
+
[22:59:58] [DEBUG]: This is a debug message
|
|
181
|
+
[22:59:58] [SILLY]: This is a silly message
|
|
182
|
+
[22:59:58] [FATAL]: This is an info message
|
|
183
|
+
<number> 123
|
|
184
|
+
<boolean> true
|
|
185
|
+
[22:59:58] [INFO]: <object> {
|
|
186
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
187
|
+
'11111'
|
|
188
|
+
}
|
|
189
|
+
[22:59:58] [INFO]: timetest: 230.400us
|
|
190
|
+
[23:00:48] [FATAL]: This is an fatal message
|
|
191
|
+
[23:00:48] [ERROR]: This is an error message
|
|
192
|
+
[23:00:48] [WARN]: This is a warning message
|
|
193
|
+
[23:00:48] [INFO]: This is an info message
|
|
194
|
+
[23:00:48] [HTTP]: This is an http message
|
|
195
|
+
[23:00:48] [VERBOSE]: This is a verbose message
|
|
196
|
+
[23:00:48] [DEBUG]: This is a debug message
|
|
197
|
+
[23:00:48] [SILLY]: This is a silly message
|
|
198
|
+
[23:00:48] [FATAL]: This is an info message
|
|
199
|
+
<number> 123
|
|
200
|
+
<boolean> true
|
|
201
|
+
[23:00:48] [INFO]: <object> {
|
|
202
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
203
|
+
'11111'
|
|
204
|
+
}
|
|
205
|
+
[23:00:48] [INFO]: timetest: 747.000ms482.100us
|
|
206
|
+
[23:01:42] [FATAL]: This is an fatal message
|
|
207
|
+
[23:01:42] [ERROR]: This is an error message
|
|
208
|
+
[23:01:42] [WARN]: This is a warning message
|
|
209
|
+
[23:01:42] [INFO]: This is an info message
|
|
210
|
+
[23:01:42] [HTTP]: This is an http message
|
|
211
|
+
[23:01:42] [VERBOSE]: This is a verbose message
|
|
212
|
+
[23:01:42] [DEBUG]: This is a debug message
|
|
213
|
+
[23:01:42] [SILLY]: This is a silly message
|
|
214
|
+
[23:01:42] [FATAL]: This is an info message
|
|
215
|
+
<number> 123
|
|
216
|
+
<boolean> true
|
|
217
|
+
[23:01:42] [INFO]: <object> {
|
|
218
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
219
|
+
'11111'
|
|
220
|
+
}
|
|
221
|
+
[23:01:43] [INFO]: timetest: 244ms150.200us
|
|
222
|
+
[23:02:32] [FATAL]: This is an fatal message
|
|
223
|
+
[23:02:32] [ERROR]: This is an error message
|
|
224
|
+
[23:02:32] [WARN]: This is a warning message
|
|
225
|
+
[23:02:32] [INFO]: This is an info message
|
|
226
|
+
[23:02:32] [HTTP]: This is an http message
|
|
227
|
+
[23:02:32] [VERBOSE]: This is a verbose message
|
|
228
|
+
[23:02:32] [DEBUG]: This is a debug message
|
|
229
|
+
[23:02:32] [SILLY]: This is a silly message
|
|
230
|
+
[23:02:32] [FATAL]: This is an info message
|
|
231
|
+
<number> 123
|
|
232
|
+
<boolean> true
|
|
233
|
+
[23:02:32] [INFO]: <object> {
|
|
234
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
235
|
+
'11111'
|
|
236
|
+
}
|
|
237
|
+
[23:02:34] [INFO]: timetest: 2s231ms314.700us
|
|
238
|
+
[23:21:41] [FATAL]: This is an fatal message
|
|
239
|
+
[23:21:41] [ERROR]: This is an error message
|
|
240
|
+
[23:21:41] [WARN]: This is a warning message
|
|
241
|
+
[23:21:41] [INFO]: This is an info message
|
|
242
|
+
[23:21:41] [HTTP]: This is an http message
|
|
243
|
+
[23:21:41] [VERBOSE]: This is a verbose message
|
|
244
|
+
[23:21:41] [DEBUG]: This is a debug message
|
|
245
|
+
[23:21:41] [SILLY]: This is a silly message
|
|
246
|
+
[23:21:41] [FATAL]: This is an info message
|
|
247
|
+
<number> 123
|
|
248
|
+
<boolean> true
|
|
249
|
+
[23:21:41] [INFO]: <object> {
|
|
250
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
251
|
+
'11111'
|
|
252
|
+
}
|
|
253
|
+
[23:21:44] [INFO]: timetest: 2.218s
|
|
254
|
+
[23:23:57] [FATAL]: This is an fatal message
|
|
255
|
+
[23:23:57] [ERROR]: This is an error message
|
|
256
|
+
[23:23:57] [WARN]: This is a warning message
|
|
257
|
+
[23:23:57] [INFO]: This is an info message
|
|
258
|
+
[23:23:57] [HTTP]: This is an http message
|
|
259
|
+
[23:23:57] [VERBOSE]: This is a verbose message
|
|
260
|
+
[23:23:57] [DEBUG]: This is a debug message
|
|
261
|
+
[23:23:57] [SILLY]: This is a silly message
|
|
262
|
+
[23:23:57] [FATAL]: This is an info message
|
|
263
|
+
<number> 123
|
|
264
|
+
<boolean> true
|
|
265
|
+
[23:23:57] [INFO]: <object> {
|
|
266
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
267
|
+
'11111'
|
|
268
|
+
}
|
|
269
|
+
[23:23:59] [INFO]: timetest: 2.185s
|
|
270
|
+
[23:25:50] [FATAL]: This is an fatal message
|
|
271
|
+
[23:25:50] [ERROR]: This is an error message
|
|
272
|
+
[23:25:50] [WARN]: This is a warning message
|
|
273
|
+
[23:25:50] [INFO]: This is an info message
|
|
274
|
+
[23:25:50] [HTTP]: This is an http message
|
|
275
|
+
[23:25:50] [VERBOSE]: This is a verbose message
|
|
276
|
+
[23:25:50] [DEBUG]: This is a debug message
|
|
277
|
+
[23:25:50] [SILLY]: This is a silly message
|
|
278
|
+
[23:25:50] [FATAL]: This is an info message
|
|
279
|
+
<number> 123
|
|
280
|
+
<boolean> true
|
|
281
|
+
[23:25:50] [INFO]: <object> {
|
|
282
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
283
|
+
'11111'
|
|
284
|
+
}
|
|
285
|
+
[23:25:52] [INFO]: timetest: 2.206s
|
|
286
|
+
[23:26:11] [FATAL]: This is an fatal message
|
|
287
|
+
[23:26:11] [ERROR]: This is an error message
|
|
288
|
+
[23:26:11] [WARN]: This is a warning message
|
|
289
|
+
[23:26:11] [INFO]: This is an info message
|
|
290
|
+
[23:26:11] [HTTP]: This is an http message
|
|
291
|
+
[23:26:11] [VERBOSE]: This is a verbose message
|
|
292
|
+
[23:26:11] [DEBUG]: This is a debug message
|
|
293
|
+
[23:26:11] [SILLY]: This is a silly message
|
|
294
|
+
[23:26:11] [FATAL]: This is an info message
|
|
295
|
+
<number> 123
|
|
296
|
+
<boolean> true
|
|
297
|
+
[23:26:11] [INFO]: <object> {
|
|
298
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
299
|
+
'11111'
|
|
300
|
+
}
|
|
301
|
+
[23:26:13] [INFO]: timetest: 2.200s
|
|
302
|
+
[23:26:47] [FATAL]: This is an fatal message
|
|
303
|
+
[23:26:47] [ERROR]: This is an error message
|
|
304
|
+
[23:26:47] [WARN]: This is a warning message
|
|
305
|
+
[23:26:47] [INFO]: This is an info message
|
|
306
|
+
[23:26:47] [HTTP]: This is an http message
|
|
307
|
+
[23:26:47] [VERBOSE]: This is a verbose message
|
|
308
|
+
[23:26:47] [DEBUG]: This is a debug message
|
|
309
|
+
[23:26:47] [SILLY]: This is a silly message
|
|
310
|
+
[23:26:47] [FATAL]: This is an info message
|
|
311
|
+
<number> 123
|
|
312
|
+
<boolean> true
|
|
313
|
+
[23:26:47] [INFO]: <object> {
|
|
314
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
315
|
+
'11111'
|
|
316
|
+
}
|
|
317
|
+
[23:26:50] [INFO]: timetest: 2.190s
|
|
318
|
+
[23:27:12] [FATAL]: This is an fatal message
|
|
319
|
+
[23:27:12] [ERROR]: This is an error message
|
|
320
|
+
[23:27:12] [WARN]: This is a warning message
|
|
321
|
+
[23:27:12] [INFO]: This is an info message
|
|
322
|
+
[23:27:12] [HTTP]: This is an http message
|
|
323
|
+
[23:27:12] [VERBOSE]: This is a verbose message
|
|
324
|
+
[23:27:12] [DEBUG]: This is a debug message
|
|
325
|
+
[23:27:12] [SILLY]: This is a silly message
|
|
326
|
+
[23:27:12] [FATAL]: This is an info message
|
|
327
|
+
<number> 123
|
|
328
|
+
<boolean> true
|
|
329
|
+
[23:27:12] [INFO]: <object> {
|
|
330
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
331
|
+
'11111'
|
|
332
|
+
}
|
|
333
|
+
[23:27:15] [INFO]: timetest: 2.433s
|
|
334
|
+
[23:27:39] [FATAL]: This is an fatal message
|
|
335
|
+
[23:27:39] [ERROR]: This is an error message
|
|
336
|
+
[23:27:39] [WARN]: This is a warning message
|
|
337
|
+
[23:27:39] [INFO]: This is an info message
|
|
338
|
+
[23:27:39] [HTTP]: This is an http message
|
|
339
|
+
[23:27:39] [VERBOSE]: This is a verbose message
|
|
340
|
+
[23:27:39] [DEBUG]: This is a debug message
|
|
341
|
+
[23:27:39] [SILLY]: This is a silly message
|
|
342
|
+
[23:27:39] [FATAL]: This is an info message
|
|
343
|
+
<number> 123
|
|
344
|
+
<boolean> true
|
|
345
|
+
[23:27:39] [INFO]: <object> {
|
|
346
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
347
|
+
'11111'
|
|
348
|
+
}
|
|
349
|
+
[23:27:41] [INFO]: timetest: 2.209s
|
|
350
|
+
[23:28:00] [FATAL]: This is an fatal message
|
|
351
|
+
[23:28:00] [ERROR]: This is an error message
|
|
352
|
+
[23:28:00] [WARN]: This is a warning message
|
|
353
|
+
[23:28:00] [INFO]: This is an info message
|
|
354
|
+
[23:28:00] [HTTP]: This is an http message
|
|
355
|
+
[23:28:00] [VERBOSE]: This is a verbose message
|
|
356
|
+
[23:28:00] [DEBUG]: This is a debug message
|
|
357
|
+
[23:28:00] [SILLY]: This is a silly message
|
|
358
|
+
[23:28:00] [FATAL]: This is an info message
|
|
359
|
+
<number> 123
|
|
360
|
+
<boolean> true
|
|
361
|
+
[23:28:00] [INFO]: <object> {
|
|
362
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
363
|
+
'11111'
|
|
364
|
+
}
|
|
365
|
+
[23:28:02] [INFO]: timetest: 2.298s
|
|
366
|
+
[23:33:11] [FATAL]: This is an fatal message
|
|
367
|
+
[23:33:11] [ERROR]: This is an error message
|
|
368
|
+
[23:33:11] [WARN]: This is a warning message
|
|
369
|
+
[23:33:11] [INFO]: This is an info message
|
|
370
|
+
[23:33:11] [HTTP]: This is an http message
|
|
371
|
+
[23:33:11] [VERBOSE]: This is a verbose message
|
|
372
|
+
[23:33:11] [DEBUG]: This is a debug message
|
|
373
|
+
[23:33:11] [SILLY]: This is a silly message
|
|
374
|
+
[23:33:11] [FATAL]: This is an info message
|
|
375
|
+
<number> 123
|
|
376
|
+
<boolean> true
|
|
377
|
+
[23:33:11] [INFO]: <object> {
|
|
378
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
379
|
+
'11111'
|
|
380
|
+
}
|
|
381
|
+
[23:33:13] [INFO]: timetest: 2.176s
|
|
382
|
+
[23:35:22] [FATAL]: This is an fatal message
|
|
383
|
+
[23:35:22] [ERROR]: This is an error message
|
|
384
|
+
[23:35:22] [WARN]: This is a warning message
|
|
385
|
+
[23:35:22] [INFO]: This is an info message
|
|
386
|
+
[23:35:22] [HTTP]: This is an http message
|
|
387
|
+
[23:35:22] [VERBOSE]: This is a verbose message
|
|
388
|
+
[23:35:22] [DEBUG]: This is a debug message
|
|
389
|
+
[23:35:22] [SILLY]: This is a silly message
|
|
390
|
+
[23:35:22] [FATAL]: This is an info message
|
|
391
|
+
<number> 123
|
|
392
|
+
<boolean> true
|
|
393
|
+
[23:35:22] [INFO]: <object> {
|
|
394
|
+
a: '1111111111111111111111111111111111111111111111111111111111111111111111111111111\n' +
|
|
395
|
+
'11111'
|
|
396
|
+
}
|
|
397
|
+
[23:35:24] [INFO]: timetest: 2.188s
|