90dc-core 1.0.2 → 1.0.4
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/index.js +2 -0
- package/dist/lib/util/Logger.d.ts +3 -0
- package/dist/lib/util/Logger.js +40 -0
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -15,9 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Greeter = void 0;
|
|
18
|
+
const Logger_1 = require("./lib/util/Logger");
|
|
18
19
|
const Greeter = (name) => `Hello ${name}`;
|
|
19
20
|
exports.Greeter = Greeter;
|
|
20
21
|
__exportStar(require("./lib/models/ProgramInterfaces"), exports);
|
|
21
22
|
__exportStar(require("./lib/models/ExerciseInterfaces"), exports);
|
|
22
23
|
__exportStar(require("./lib/models/WorkoutInterfaces"), exports);
|
|
23
24
|
__exportStar(require("./lib/models/ProgramInterfaces"), exports);
|
|
25
|
+
Logger_1.default.debug("hello");
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const winston_1 = require("winston");
|
|
4
|
+
const logFileName = 'logs/error.log';
|
|
5
|
+
const levels = {
|
|
6
|
+
error: 0,
|
|
7
|
+
warn: 1,
|
|
8
|
+
info: 2,
|
|
9
|
+
http: 3,
|
|
10
|
+
debug: 4,
|
|
11
|
+
};
|
|
12
|
+
const colors = {
|
|
13
|
+
error: 'red',
|
|
14
|
+
warn: 'yellow',
|
|
15
|
+
info: 'green',
|
|
16
|
+
http: 'magenta',
|
|
17
|
+
debug: 'white',
|
|
18
|
+
};
|
|
19
|
+
function level() {
|
|
20
|
+
const env = process.env.NODE_ENV || 'development';
|
|
21
|
+
const isDevelopment = env === 'development';
|
|
22
|
+
return isDevelopment ? 'debug' : 'warn';
|
|
23
|
+
}
|
|
24
|
+
winston_1.default.addColors(colors);
|
|
25
|
+
const format = winston_1.default.format.combine(winston_1.default.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), winston_1.default.format.colorize({ all: true }), winston_1.default.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`));
|
|
26
|
+
const transports = [
|
|
27
|
+
new winston_1.default.transports.Console(),
|
|
28
|
+
new winston_1.default.transports.File({
|
|
29
|
+
filename: logFileName,
|
|
30
|
+
level: 'error',
|
|
31
|
+
}),
|
|
32
|
+
new winston_1.default.transports.File({ filename: logFileName }),
|
|
33
|
+
];
|
|
34
|
+
const Logger = winston_1.default.createLogger({
|
|
35
|
+
level: level(),
|
|
36
|
+
levels,
|
|
37
|
+
format,
|
|
38
|
+
transports
|
|
39
|
+
});
|
|
40
|
+
exports.default = Logger;
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "90dc-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist/**/*"
|
|
8
8
|
],
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
9
10
|
"scripts": {
|
|
10
11
|
"build": "tsc",
|
|
11
12
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
12
13
|
"lint": "tslint -p tsconfig.json",
|
|
13
14
|
"prepare": "npm run build",
|
|
14
|
-
"prepublishOnly": "npm
|
|
15
|
+
"prepublishOnly": "npm run lint",
|
|
15
16
|
"preversion": "npm run lint",
|
|
16
17
|
"version": "npm run format && git add -A src",
|
|
17
18
|
"postversion": "git push && git push --tags",
|
|
@@ -28,5 +29,8 @@
|
|
|
28
29
|
"tslint": "^6.1.3",
|
|
29
30
|
"tslint-config-prettier": "^1.18.0",
|
|
30
31
|
"typescript": "^4.9.4"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"winston": "^3.8.2"
|
|
31
35
|
}
|
|
32
36
|
}
|