skyeye-svc-common-utils 2.0.0-dev0.22 → 2.0.0-dev0.24
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.
|
@@ -11,15 +11,15 @@ const appConfig_1 = require("../appConfig");
|
|
|
11
11
|
const dateformat_1 = __importDefault(require("dateformat"));
|
|
12
12
|
// ensure log directory exists
|
|
13
13
|
fs_1.default.existsSync(appConfig_1.commonAppConfig.LogPath) || fs_1.default.mkdirSync(appConfig_1.commonAppConfig.LogPath);
|
|
14
|
-
|
|
14
|
+
function FileNameGenerator(time, index) {
|
|
15
15
|
if (!time) {
|
|
16
16
|
time = new Date();
|
|
17
17
|
}
|
|
18
18
|
let indexStr = index ? ("-" + JSON.stringify(index)) : "";
|
|
19
19
|
return `backend-access-${(0, dateformat_1.default)(time, 'yyyy-mm-dd')}${indexStr}.log`;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
// create a rotating write stream
|
|
22
|
-
var accessLogStream = rotating_file_stream_1.default
|
|
22
|
+
var accessLogStream = (0, rotating_file_stream_1.default)(FileNameGenerator, {
|
|
23
23
|
interval: '1d', // rotate daily
|
|
24
24
|
path: appConfig_1.commonAppConfig.LogPath
|
|
25
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morganLogger.js","sourceRoot":"","sources":["../../../src/utils/logger/morganLogger.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,oDAA4B;AAC5B,gFAAuC;AACvC,4CAA6C;AAC7C,4DAAoC;AAEpC,8BAA8B;AAC9B,YAAE,CAAC,UAAU,CAAC,2BAAe,CAAC,OAAO,CAAC,IAAI,YAAE,CAAC,SAAS,CAAC,2BAAe,CAAC,OAAO,CAAC,CAAA;AAE/E,
|
|
1
|
+
{"version":3,"file":"morganLogger.js","sourceRoot":"","sources":["../../../src/utils/logger/morganLogger.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,oDAA4B;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AAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI;QAClD,aAAa,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;QAC/C,SAAS,EAAE,2BAAe,CAAC,OAAO;KACnC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,mBAAmB;AACN,QAAA,UAAU,GAAG,IAAA,gBAAM,EAAC,UAAU,EAAE,EAAE,MAAM,EAAE,eAAe,GAAG,CAAC,CAAA;AAE7D,QAAA,aAAa,GAAI,IAAA,gBAAM,EAAC,UAAU,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skyeye-svc-common-utils",
|
|
3
|
-
"version": "2.0.0-dev0.
|
|
3
|
+
"version": "2.0.0-dev0.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,26 +32,20 @@
|
|
|
32
32
|
"async-mutex": "^0.3.2",
|
|
33
33
|
"cron-parser": "4.8.1",
|
|
34
34
|
"dateformat": "^3.0.3",
|
|
35
|
-
"debug": "^4.1.1",
|
|
36
35
|
"dotenv": "^8.2.0",
|
|
37
36
|
"elastic-apm-node": "^3.5.0",
|
|
38
37
|
"express": "^4.17.1",
|
|
39
|
-
"http-errors": "^1.7.3",
|
|
40
38
|
"https": "^1.0.0",
|
|
41
39
|
"ioredis": "^5.0.4",
|
|
42
40
|
"jsonwebtoken": "^9.0.2",
|
|
43
41
|
"lodash": "^4.17.21",
|
|
44
|
-
"logform": "2.4.2",
|
|
45
42
|
"moment": "^2.24.0",
|
|
46
43
|
"morgan": "^1.9.1",
|
|
47
44
|
"node-fetch": "^2.6.0",
|
|
48
|
-
"
|
|
49
|
-
"rotating-file-stream": "^3.2.1",
|
|
45
|
+
"rotating-file-stream": "^1.4.6",
|
|
50
46
|
"skyeye-common-const": "1.0.42",
|
|
51
47
|
"swagger-jsdoc": "^3.5.0",
|
|
52
|
-
"ts-node": "^10.7.0",
|
|
53
48
|
"typeorm": "^0.3.17",
|
|
54
|
-
"typescript": "^5.3.3",
|
|
55
49
|
"winston": "^3.2.1",
|
|
56
50
|
"winston-daily-rotate-file": "^4.2.1",
|
|
57
51
|
"abort-controller": "3.0.0",
|
|
@@ -59,15 +53,9 @@
|
|
|
59
53
|
},
|
|
60
54
|
"devDependencies": {
|
|
61
55
|
"@types/dateformat": "^5.0.2",
|
|
62
|
-
"@types/debug": "^4.1.12",
|
|
63
|
-
"@types/http-errors": "~2.0.4",
|
|
64
56
|
"@types/morgan": "~1.9.9",
|
|
65
|
-
"@types/node": "^20.11.19",
|
|
66
57
|
"@types/node-fetch": "^2.6.11",
|
|
67
|
-
"@types/chai": "^4.3.11",
|
|
68
58
|
"@types/express": "^4.17.21",
|
|
69
|
-
"@types/express-serve-static-core": "^4.17.43",
|
|
70
|
-
"@types/google-protobuf": "^3.15.12",
|
|
71
59
|
"@types/jsonwebtoken": "^9.0.6",
|
|
72
60
|
"@types/lodash": "^4.14.202",
|
|
73
61
|
"@types/swagger-jsdoc": "^6.0.4"
|
|
@@ -7,7 +7,7 @@ import dateformat from 'dateformat';
|
|
|
7
7
|
// ensure log directory exists
|
|
8
8
|
fs.existsSync(commonAppConfig.LogPath) || fs.mkdirSync(commonAppConfig.LogPath)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function FileNameGenerator(time:Date, index:number){
|
|
11
11
|
if (!time)
|
|
12
12
|
{
|
|
13
13
|
time = new Date();
|
|
@@ -18,7 +18,7 @@ const FileNameGenerator = (time: number | Date, index: number) =>{
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// create a rotating write stream
|
|
21
|
-
var accessLogStream = rfs
|
|
21
|
+
var accessLogStream = rfs(FileNameGenerator, {
|
|
22
22
|
interval: '1d', // rotate daily
|
|
23
23
|
path: commonAppConfig.LogPath
|
|
24
24
|
})
|