90dc-core 1.2.5 → 1.2.6
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.map +1 -1
- package/dist/lib/utils/Logger.d.ts +1 -5
- package/dist/lib/utils/Logger.js +2 -12
- package/dist/lib/utils/Logger.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/lib/utils/Logger.ts +2 -16
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["//Interfaces\nexport * from \"./lib/models/ProgramInterfaces\";\nexport * from \"./lib/models/ExerciseInterfaces\";\nexport * from \"./lib/models/WorkoutInterfaces\";\nexport * from \"./lib/models/UserInterfaces\";\n\n//Utils\nexport * from \"./lib/utils/Logger\"\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["//Interfaces\nexport * from \"./lib/models/ProgramInterfaces\";\nexport * from \"./lib/models/ExerciseInterfaces\";\nexport * from \"./lib/models/WorkoutInterfaces\";\nexport * from \"./lib/models/UserInterfaces\";\n\n//Utils\nexport * from \"./lib/utils/Logger\"\n"],"names":[],"mappings":"AAAA,YAAY;AACZ,cAAc,iCAAiC;AAC/C,cAAc,kCAAkC;AAChD,cAAc,iCAAiC;AAC/C,cAAc,8BAA8B;AAE5C,OAAO;AACP,cAAc,qBAAoB"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import winston from 'winston';
|
|
2
2
|
declare class Logger {
|
|
3
|
-
|
|
4
|
-
static get serviceName(): string;
|
|
5
|
-
static set serviceName(value: string);
|
|
6
|
-
constructor(name: string);
|
|
7
|
-
static getLogger(): winston.Logger;
|
|
3
|
+
static getLogger(serviceName: string): winston.Logger;
|
|
8
4
|
}
|
|
9
5
|
export default Logger;
|
package/dist/lib/utils/Logger.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import winston from 'winston';
|
|
2
2
|
class Logger {
|
|
3
|
-
static
|
|
4
|
-
static get serviceName() {
|
|
5
|
-
return this._serviceName;
|
|
6
|
-
}
|
|
7
|
-
static set serviceName(value) {
|
|
8
|
-
this._serviceName = value;
|
|
9
|
-
}
|
|
10
|
-
constructor(name) {
|
|
11
|
-
Logger._serviceName = name;
|
|
12
|
-
}
|
|
13
|
-
static getLogger() {
|
|
3
|
+
static getLogger(serviceName) {
|
|
14
4
|
const levels = {
|
|
15
5
|
error: 0,
|
|
16
6
|
warn: 1,
|
|
@@ -33,7 +23,7 @@ class Logger {
|
|
|
33
23
|
winston.addColors(colors);
|
|
34
24
|
const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), winston.format.colorize({ all: true }), winston.format.printf(
|
|
35
25
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
36
|
-
(info) => `${info.timestamp}@${
|
|
26
|
+
(info) => `${info.timestamp}@${serviceName}/${info.level}: ${info.message}`));
|
|
37
27
|
const transports = [
|
|
38
28
|
new winston.transports.Console(),
|
|
39
29
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/utils/Logger.ts"],"sourcesContent":["import winston from 'winston'\n\nclass Logger {\n\n
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/Logger.ts"],"sourcesContent":["import winston from 'winston'\n\nclass Logger {\n\n public static getLogger(serviceName: string){\n const levels = {\n error: 0,\n warn: 1,\n info: 2,\n http: 3,\n debug: 4,\n }\n\n const level = () => {\n const env = process.env.NODE_ENV || 'development'\n const isDevelopment = env === 'development'\n return isDevelopment ? 'debug' : 'warn'\n }\n\n const colors = {\n error: 'red',\n warn: 'yellow',\n info: 'green',\n http: 'magenta',\n debug: 'white',\n }\n\n winston.addColors(colors)\n\n const format: winston.Logform.Format = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),\n winston.format.colorize({ all: true }),\n winston.format.printf(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n (info) => `${info.timestamp}@${serviceName}/${info.level}: ${info.message}`,\n ),\n )\n\n const transports = [\n new winston.transports.Console(),\n ]\n return winston.createLogger({\n level: level(),\n levels,\n format,\n transports,\n })\n\n }\n}\n\n\nexport default Logger"],"names":["winston","Logger","getLogger","serviceName","levels","error","warn","info","http","debug","level","env","process","NODE_ENV","isDevelopment","colors","addColors","format","combine","timestamp","colorize","all","printf","message","transports","Console","createLogger"],"mappings":"AAAA,OAAOA,aAAa,UAAS;AAE7B,MAAMC;IAEJ,OAAcC,UAAUC,WAAmB,EAAC;QAC1C,MAAMC,SAAS;YACbC,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEA,MAAMC,QAAQ,IAAM;YAClB,MAAMC,MAAMC,QAAQD,GAAG,CAACE,QAAQ,IAAI;YACpC,MAAMC,gBAAgBH,QAAQ;YAC9B,OAAOG,gBAAgB,UAAU,MAAM;QACzC;QAEA,MAAMC,SAAS;YACbV,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEAT,QAAQgB,SAAS,CAACD;QAElB,MAAME,SAAiCjB,QAAQiB,MAAM,CAACC,OAAO,CAC3DlB,QAAQiB,MAAM,CAACE,SAAS,CAAC;YAAEF,QAAQ;QAAyB,IAC5DjB,QAAQiB,MAAM,CAACG,QAAQ,CAAC;YAAEC,KAAK,IAAI;QAAC,IACpCrB,QAAQiB,MAAM,CAACK,MAAM,CACnB,4EAA4E;QAC5E,CAACf,OAAS,CAAC,EAAEA,KAAKY,SAAS,CAAC,CAAC,EAAEhB,YAAY,CAAC,EAAEI,KAAKG,KAAK,CAAC,EAAE,EAAEH,KAAKgB,OAAO,CAAC,CAAC;QAI/E,MAAMC,aAAa;YACjB,IAAIxB,QAAQwB,UAAU,CAACC,OAAO;SAC/B;QACD,OAAOzB,QAAQ0B,YAAY,CAAC;YAC1BhB,OAAOA;YACPN;YACAa;YACAO;QACF;IAEF;AACF;AAGA,eAAevB,OAAM"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/lib/utils/Logger.ts
CHANGED
|
@@ -2,21 +2,7 @@ import winston from 'winston'
|
|
|
2
2
|
|
|
3
3
|
class Logger {
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
static get serviceName(): string {
|
|
8
|
-
return this._serviceName;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
static set serviceName(value: string) {
|
|
12
|
-
this._serviceName = value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
constructor(name: string) {
|
|
16
|
-
Logger._serviceName = name;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public static getLogger(){
|
|
5
|
+
public static getLogger(serviceName: string){
|
|
20
6
|
const levels = {
|
|
21
7
|
error: 0,
|
|
22
8
|
warn: 1,
|
|
@@ -46,7 +32,7 @@ class Logger {
|
|
|
46
32
|
winston.format.colorize({ all: true }),
|
|
47
33
|
winston.format.printf(
|
|
48
34
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
49
|
-
(info) => `${info.timestamp}@${
|
|
35
|
+
(info) => `${info.timestamp}@${serviceName}/${info.level}: ${info.message}`,
|
|
50
36
|
),
|
|
51
37
|
)
|
|
52
38
|
|