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 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\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
+ {"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
- private static _serviceName;
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;
@@ -1,16 +1,6 @@
1
1
  import winston from 'winston';
2
2
  class Logger {
3
- static _serviceName = "";
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}@${this._serviceName}/${info.level}: ${info.message}`));
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 private static _serviceName = \"\";\n\n static get serviceName(): string {\n return this._serviceName;\n }\n\n static set serviceName(value: string) {\n this._serviceName = value;\n }\n\n constructor(name: string) {\n Logger._serviceName = name;\n }\n\n public static getLogger(){\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}@${this._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","_serviceName","serviceName","value","constructor","name","getLogger","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,OAAeC,eAAe,GAAG;IAEjC,WAAWC,cAAsB;QAC/B,OAAO,IAAI,CAACD,YAAY;IAC1B;IAEA,WAAWC,YAAYC,KAAa,EAAE;QACpC,IAAI,CAACF,YAAY,GAAGE;IACtB;IAEAC,YAAYC,IAAY,CAAE;QACxBL,OAAOC,YAAY,GAAGI;IACxB;IAEA,OAAcC,YAAW;QACvB,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;QAEAb,QAAQoB,SAAS,CAACD;QAElB,MAAME,SAAiCrB,QAAQqB,MAAM,CAACC,OAAO,CAC3DtB,QAAQqB,MAAM,CAACE,SAAS,CAAC;YAAEF,QAAQ;QAAyB,IAC5DrB,QAAQqB,MAAM,CAACG,QAAQ,CAAC;YAAEC,KAAK,IAAI;QAAC,IACpCzB,QAAQqB,MAAM,CAACK,MAAM,CACnB,4EAA4E;QAC5E,CAACf,OAAS,CAAC,EAAEA,KAAKY,SAAS,CAAC,CAAC,EAAE,IAAI,CAACrB,YAAY,CAAC,CAAC,EAAES,KAAKG,KAAK,CAAC,EAAE,EAAEH,KAAKgB,OAAO,CAAC,CAAC;QAIrF,MAAMC,aAAa;YACjB,IAAI5B,QAAQ4B,UAAU,CAACC,OAAO;SAC/B;QACD,OAAO7B,QAAQ8B,YAAY,CAAC;YAC1BhB,OAAOA;YACPN;YACAa;YACAO;QACF;IAEF;AACF;AAGA,eAAe3B,OAAM"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "A package that contains utils and interfaces used to create 90dc",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -6,4 +6,3 @@ export * from "./lib/models/UserInterfaces";
6
6
 
7
7
  //Utils
8
8
  export * from "./lib/utils/Logger"
9
-
@@ -2,21 +2,7 @@ import winston from 'winston'
2
2
 
3
3
  class Logger {
4
4
 
5
- private static _serviceName = "";
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}@${this._serviceName}/${info.level}: ${info.message}`,
35
+ (info) => `${info.timestamp}@${serviceName}/${info.level}: ${info.message}`,
50
36
  ),
51
37
  )
52
38