90dc-core 1.2.1 → 1.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "A package that contains utils and interfaces used to create 90dc",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
@@ -1,70 +0,0 @@
1
- import winston from 'winston'
2
-
3
- class Logger {
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
-
16
-
17
- public static getLogger(){
18
- const levels = {
19
- error: 0,
20
- warn: 1,
21
- info: 2,
22
- http: 3,
23
- debug: 4,
24
- }
25
-
26
- const level = () => {
27
- const env = process.env.NODE_ENV || 'development'
28
- const isDevelopment = env === 'development'
29
- return isDevelopment ? 'debug' : 'warn'
30
- }
31
-
32
- const colors = {
33
- error: 'red',
34
- warn: 'yellow',
35
- info: 'green',
36
- http: 'magenta',
37
- debug: 'white',
38
- }
39
-
40
- winston.addColors(colors)
41
-
42
- const format: winston.Logform.Format = winston.format.combine(
43
- winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),
44
- winston.format.colorize({ all: true }),
45
- winston.format.printf(
46
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
47
- (info) => `${info.timestamp}@${this._serviceName} ${info.level}: ${info.message}`,
48
- ),
49
- )
50
-
51
- const transports = [
52
- new winston.transports.Console(),
53
- new winston.transports.File({
54
- filename: 'logs/error.log',
55
- level: 'error',
56
- }),
57
- new winston.transports.File({ filename: 'logs/all.log' }),
58
- ]
59
- return winston.createLogger({
60
- level: level(),
61
- levels,
62
- format,
63
- transports,
64
- })
65
-
66
- }
67
- }
68
-
69
-
70
- export default Logger