@skax/logger 0.1.0 → 1.0.1

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/README.md CHANGED
@@ -11,5 +11,38 @@ yarn add @skax/logger
11
11
  ```ts
12
12
  import Logger from '@skax/logger';
13
13
 
14
- Logger.v('console.log print');
14
+ const logger = new Logger();
15
+
16
+ logger.d('console.debug print'); // debug
17
+ logger.v('console.log print'); // log
18
+ logger.i('console.info print'); // info
19
+ logger.w('console.warn print'); // warn
20
+ logger.e('console.error print'); // error
21
+ ```
22
+
23
+ ### umd
24
+
25
+ ```html
26
+ <script src="./index.umd.js"></script>
27
+ <script>
28
+ (function () {
29
+ const logger = new Logger();
30
+
31
+ logger.v(logger.version());
32
+
33
+ logger.d('1234132');
34
+ logger.v('1234132');
35
+ logger.i('1234132');
36
+ logger.w('1234132');
37
+ logger.e('1234132');
38
+
39
+ logger.setOptions({ level: 'WARN' });
40
+
41
+ logger.d('2-1234132');
42
+ logger.v('2-1234132');
43
+ logger.i('2-1234132');
44
+ logger.w('2-1234132');
45
+ logger.e('2-1234132');
46
+ })();
47
+ </script>
15
48
  ```
package/index.js CHANGED
@@ -1,165 +1,112 @@
1
1
  /*
2
2
  *
3
- * @skax/logger.js v0.1.0
4
- * Copyright (c) 2023-7-15 ShineShao <xiaoshaoqq@gmail.com>
3
+ * @skax/logger.js v1.0.1
4
+ * Copyright (c) 2023-9-30 ShineShao <xiaoshaoqq@gmail.com>
5
5
  * Released under the MIT License.
6
6
  *
7
7
  */
8
8
  'use strict';
9
9
 
10
- function __spreadArray(to, from, pack) {
11
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
12
- if (ar || !(i in from)) {
13
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
14
- ar[i] = from[i];
15
- }
16
- }
17
- return to.concat(ar || Array.prototype.slice.call(from));
18
- }
19
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
20
- var e = new Error(message);
21
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
22
- };
23
-
24
10
  /**
25
- * @class Logger class
11
+ * @class Logger
26
12
  * @classdesc Provide multiple log printing methods
13
+ * @example
14
+ * const logger = new Logger({})
15
+ * logger.v("verbose log")
27
16
  */
28
17
  var Logger = /** @class */ (function () {
29
- function Logger() {
18
+ function Logger(options) {
19
+ if (options === void 0) { options = {}; }
20
+ this._options = {};
21
+ this._levelNum = 0;
22
+ /**
23
+ * @description Method used to print error logs
24
+ * @method
25
+ *
26
+ * @example
27
+ * logger.e("error message") // error message
28
+ *
29
+ * @param {...any[]} args error messages
30
+ * @returns {void}
31
+ */
32
+ this.e = this._loggerFactory('error', this._levelNum <= 4);
33
+ /**
34
+ * @description Method used to print warn logs
35
+ * @method
36
+ *
37
+ * @example
38
+ * logger.w("warn message") // warn message
39
+ *
40
+ * @param {...any[]} args warn messages
41
+ * @returns {void}
42
+ */
43
+ this.w = this._loggerFactory('warn', this._levelNum <= 3);
44
+ /**
45
+ * @description Method used to print info logs
46
+ * @method
47
+ *
48
+ * @example
49
+ * logger.i("info message") // info message
50
+ *
51
+ * @param {...any[]} args info messages
52
+ * @returns {void}
53
+ */
54
+ this.i = this._loggerFactory('info', this._levelNum <= 2);
55
+ /**
56
+ * @description Method used to print verbose logs
57
+ * @method
58
+ *
59
+ * @example
60
+ * logger.v("verbose message") // verbose message
61
+ *
62
+ * @param {...any[]} args verbose messages
63
+ * @returns {void}
64
+ */
65
+ this.v = this._loggerFactory('log', this._levelNum <= 1);
66
+ /**
67
+ * @description Method used to print debug logs
68
+ * @method
69
+ *
70
+ * @example
71
+ * logger.d("debug message") // debug message
72
+ *
73
+ * @param {...any[]} msg debug messages
74
+ * @returns {void}
75
+ */
76
+ this.d = this._loggerFactory('debug', this._levelNum < 1);
77
+ this.setOptions(options);
30
78
  }
31
79
  /**
32
- * @description Static method used to print error logs
33
- * @static
34
- *
35
- * @example
36
- * Logger.e("error message") // [LOGGER ERROR] > error message
37
- *
38
- * @param {...any[]} args error messages
39
- * @returns {void}
40
- */
41
- Logger.e = function () {
42
- var arguments$1 = arguments;
43
-
44
- var args = [];
45
- for (var _i = 0; _i < arguments.length; _i++) {
46
- args[_i] = arguments$1[_i];
47
- }
48
- if (Logger.LOGGER_LEVEL <= 4)
49
- { Logger.HIDE_TAG
50
- ? console.error.apply(console, args) : console.error.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " ERROR]"), 'background: red; color: #fff'], args, false)); }
51
- };
52
- /**
53
- * @description Static method used to print warn logs
54
- * @static
55
- *
56
- * @example
57
- * Logger.w("warn message") // [LOGGER WARN] > warn message
58
- *
59
- * @param {...any[]} args warn messages
60
- * @returns {void}
61
- */
62
- Logger.w = function () {
63
- var arguments$1 = arguments;
64
-
65
- var args = [];
66
- for (var _i = 0; _i < arguments.length; _i++) {
67
- args[_i] = arguments$1[_i];
68
- }
69
- if (Logger.LOGGER_LEVEL <= 3)
70
- { Logger.HIDE_TAG
71
- ? console.warn.apply(console, args) : console.warn.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " WARN]"), 'background: #faad14; color: #fff'], args, false)); }
72
- };
73
- /**
74
- * @description Static method used to print info logs
75
- * @static
76
- *
77
- * @example
78
- * Logger.i("info message") // [LOGGER INFO] > info message
79
- *
80
- * @param {...any[]} args info messages
81
- * @returns {void}
82
- */
83
- Logger.i = function () {
84
- var arguments$1 = arguments;
85
-
86
- var args = [];
87
- for (var _i = 0; _i < arguments.length; _i++) {
88
- args[_i] = arguments$1[_i];
89
- }
90
- if (Logger.LOGGER_LEVEL <= 2)
91
- { Logger.HIDE_TAG
92
- ? console.info.apply(console, args) : console.info.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " INFO]"), 'background: #ffe58f; color: #fff'], args, false)); }
93
- };
94
- /**
95
- * @description Static method used to print verbose logs
96
- * @static
80
+ * @description Method used to set logger option and change logger level
97
81
  *
98
82
  * @example
99
- * Logger.v("verbose message") // [LOGGER VERBOSE] > verbose message
100
- *
101
- * @param {...any[]} args verbose messages
102
- * @returns {void}
103
- */
104
- Logger.v = function () {
105
- var arguments$1 = arguments;
106
-
107
- var args = [];
108
- for (var _i = 0; _i < arguments.length; _i++) {
109
- args[_i] = arguments$1[_i];
110
- }
111
- if (Logger.LOGGER_LEVEL <= 1)
112
- { Logger.HIDE_TAG ? console.log.apply(console, args) : console.log.apply(console, __spreadArray(["[".concat(Logger.TAG, " VERBOSE]")], args, false)); }
113
- };
114
- /**
115
- * @description Static method used to print debug logs
116
- * @static
117
- *
118
- * @example
119
- * Logger.d("debug message") // [LOGGER DEBUG] > debug message
120
- * Logger.d("debug message", "DEBUG") // [DEBUG] > debug message
121
- *
122
- * @param {...any[]} msg debug messages
123
- * @returns {void}
124
- */
125
- Logger.d = function () {
126
- var arguments$1 = arguments;
127
-
128
- var args = [];
129
- for (var _i = 0; _i < arguments.length; _i++) {
130
- args[_i] = arguments$1[_i];
131
- }
132
- if (Logger.LOGGER_LEVEL < 1) {
133
- Logger.HIDE_TAG
134
- ? console.log.apply(console, args) : console.log.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " DEBUG]"), 'background: #1677ff; color: #fff'], args, false));
135
- }
136
- };
137
- /**
138
- * @description Static method used to set logger option
139
- * @static
140
- *
141
- * @example
142
- * Logger.setOptions({level: 'INFO'}) // set logger level
83
+ * logger.setOptions({level: 'INFO'}) // set logger level
143
84
  *
144
85
  * @param {LoggerOptions} options logger options
145
86
  * @return {void}
146
87
  */
147
- Logger.setOptions = function (options) {
148
- Logger.LOGGER_LEVEL = Logger._matchLevel(options.level);
149
- Logger.HIDE_TAG = !!options.hideTag;
88
+ Logger.prototype.setOptions = function (options) {
89
+ this._options = options;
90
+ this._levelNum = this._matchLevel(options.level || 'DEBUG');
91
+ if (this._levelNum !== 0) {
92
+ this.e = this._loggerFactory('error', this._levelNum <= 4);
93
+ this.w = this._loggerFactory('warn', this._levelNum <= 3);
94
+ this.i = this._loggerFactory('info', this._levelNum <= 2);
95
+ this.v = this._loggerFactory('log', this._levelNum <= 1);
96
+ this.d = this._loggerFactory('warn', this._levelNum < 1);
97
+ }
150
98
  };
151
99
  /**
152
- * @description Static method used to match logger level
153
- * @static
100
+ * @description Private method used to match logger level
154
101
  * @private
155
102
  *
156
103
  * @example
157
- * Logger._matchLevel("DEBUG") // 0
104
+ * this._matchLevel("DEBUG") // 0
158
105
  *
159
106
  * @param {LoggerLevel} level logger level
160
107
  * @return {number}
161
108
  */
162
- Logger._matchLevel = function (level) {
109
+ Logger.prototype._matchLevel = function (level) {
163
110
  var logLevel = 0;
164
111
  switch (level) {
165
112
  case 'DEBUG':
@@ -180,10 +127,35 @@ var Logger = /** @class */ (function () {
180
127
  }
181
128
  return logLevel;
182
129
  };
183
- Logger.TAG = 'LOGGER';
184
- // log level default 0,
185
- Logger.LOGGER_LEVEL = 0;
186
- Logger.HIDE_TAG = false;
130
+ /**
131
+ * @private
132
+ * @description Logger factory
133
+ * @param {ConsoleKey} type
134
+ * @param {boolean} bool
135
+ * @returns
136
+ */
137
+ Logger.prototype._loggerFactory = function (type, bool) {
138
+ var func = console[type];
139
+ if (bool && func) {
140
+ return func.bind(console, "[".concat(type.toLocaleUpperCase(), "]"));
141
+ }
142
+ return Logger.noop;
143
+ };
144
+ /**
145
+ * @description Get options
146
+ * @returns {LoggerOptions}
147
+ */
148
+ Logger.prototype.getOptions = function () {
149
+ return this._options;
150
+ };
151
+ /**
152
+ * @description Get version
153
+ * @returns {string}
154
+ */
155
+ Logger.prototype.version = function () {
156
+ return '1.0.1';
157
+ };
158
+ Logger.noop = function () { };
187
159
  return Logger;
188
160
  }());
189
161
 
package/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  *
3
- * @skax/logger.js v0.1.0
4
- * Copyright (c) 2023-7-15 ShineShao <xiaoshaoqq@gmail.com>
3
+ * @skax/logger.js v1.0.1
4
+ * Copyright (c) 2023-9-30 ShineShao <xiaoshaoqq@gmail.com>
5
5
  * Released under the MIT License.
6
6
  *
7
7
  */
@@ -11,159 +11,106 @@
11
11
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Logger = factory());
12
12
  })(this, (function () { 'use strict';
13
13
 
14
- function __spreadArray(to, from, pack) {
15
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
16
- if (ar || !(i in from)) {
17
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
18
- ar[i] = from[i];
19
- }
20
- }
21
- return to.concat(ar || Array.prototype.slice.call(from));
22
- }
23
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
24
- var e = new Error(message);
25
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
26
- };
27
-
28
14
  /**
29
- * @class Logger class
15
+ * @class Logger
30
16
  * @classdesc Provide multiple log printing methods
17
+ * @example
18
+ * const logger = new Logger({})
19
+ * logger.v("verbose log")
31
20
  */
32
21
  var Logger = /** @class */ (function () {
33
- function Logger() {
22
+ function Logger(options) {
23
+ if (options === void 0) { options = {}; }
24
+ this._options = {};
25
+ this._levelNum = 0;
26
+ /**
27
+ * @description Method used to print error logs
28
+ * @method
29
+ *
30
+ * @example
31
+ * logger.e("error message") // error message
32
+ *
33
+ * @param {...any[]} args error messages
34
+ * @returns {void}
35
+ */
36
+ this.e = this._loggerFactory('error', this._levelNum <= 4);
37
+ /**
38
+ * @description Method used to print warn logs
39
+ * @method
40
+ *
41
+ * @example
42
+ * logger.w("warn message") // warn message
43
+ *
44
+ * @param {...any[]} args warn messages
45
+ * @returns {void}
46
+ */
47
+ this.w = this._loggerFactory('warn', this._levelNum <= 3);
48
+ /**
49
+ * @description Method used to print info logs
50
+ * @method
51
+ *
52
+ * @example
53
+ * logger.i("info message") // info message
54
+ *
55
+ * @param {...any[]} args info messages
56
+ * @returns {void}
57
+ */
58
+ this.i = this._loggerFactory('info', this._levelNum <= 2);
59
+ /**
60
+ * @description Method used to print verbose logs
61
+ * @method
62
+ *
63
+ * @example
64
+ * logger.v("verbose message") // verbose message
65
+ *
66
+ * @param {...any[]} args verbose messages
67
+ * @returns {void}
68
+ */
69
+ this.v = this._loggerFactory('log', this._levelNum <= 1);
70
+ /**
71
+ * @description Method used to print debug logs
72
+ * @method
73
+ *
74
+ * @example
75
+ * logger.d("debug message") // debug message
76
+ *
77
+ * @param {...any[]} msg debug messages
78
+ * @returns {void}
79
+ */
80
+ this.d = this._loggerFactory('debug', this._levelNum < 1);
81
+ this.setOptions(options);
34
82
  }
35
83
  /**
36
- * @description Static method used to print error logs
37
- * @static
38
- *
39
- * @example
40
- * Logger.e("error message") // [LOGGER ERROR] > error message
41
- *
42
- * @param {...any[]} args error messages
43
- * @returns {void}
44
- */
45
- Logger.e = function () {
46
- var arguments$1 = arguments;
47
-
48
- var args = [];
49
- for (var _i = 0; _i < arguments.length; _i++) {
50
- args[_i] = arguments$1[_i];
51
- }
52
- if (Logger.LOGGER_LEVEL <= 4)
53
- { Logger.HIDE_TAG
54
- ? console.error.apply(console, args) : console.error.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " ERROR]"), 'background: red; color: #fff'], args, false)); }
55
- };
56
- /**
57
- * @description Static method used to print warn logs
58
- * @static
59
- *
60
- * @example
61
- * Logger.w("warn message") // [LOGGER WARN] > warn message
62
- *
63
- * @param {...any[]} args warn messages
64
- * @returns {void}
65
- */
66
- Logger.w = function () {
67
- var arguments$1 = arguments;
68
-
69
- var args = [];
70
- for (var _i = 0; _i < arguments.length; _i++) {
71
- args[_i] = arguments$1[_i];
72
- }
73
- if (Logger.LOGGER_LEVEL <= 3)
74
- { Logger.HIDE_TAG
75
- ? console.warn.apply(console, args) : console.warn.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " WARN]"), 'background: #faad14; color: #fff'], args, false)); }
76
- };
77
- /**
78
- * @description Static method used to print info logs
79
- * @static
80
- *
81
- * @example
82
- * Logger.i("info message") // [LOGGER INFO] > info message
83
- *
84
- * @param {...any[]} args info messages
85
- * @returns {void}
86
- */
87
- Logger.i = function () {
88
- var arguments$1 = arguments;
89
-
90
- var args = [];
91
- for (var _i = 0; _i < arguments.length; _i++) {
92
- args[_i] = arguments$1[_i];
93
- }
94
- if (Logger.LOGGER_LEVEL <= 2)
95
- { Logger.HIDE_TAG
96
- ? console.info.apply(console, args) : console.info.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " INFO]"), 'background: #ffe58f; color: #fff'], args, false)); }
97
- };
98
- /**
99
- * @description Static method used to print verbose logs
100
- * @static
84
+ * @description Method used to set logger option and change logger level
101
85
  *
102
86
  * @example
103
- * Logger.v("verbose message") // [LOGGER VERBOSE] > verbose message
104
- *
105
- * @param {...any[]} args verbose messages
106
- * @returns {void}
107
- */
108
- Logger.v = function () {
109
- var arguments$1 = arguments;
110
-
111
- var args = [];
112
- for (var _i = 0; _i < arguments.length; _i++) {
113
- args[_i] = arguments$1[_i];
114
- }
115
- if (Logger.LOGGER_LEVEL <= 1)
116
- { Logger.HIDE_TAG ? console.log.apply(console, args) : console.log.apply(console, __spreadArray(["[".concat(Logger.TAG, " VERBOSE]")], args, false)); }
117
- };
118
- /**
119
- * @description Static method used to print debug logs
120
- * @static
121
- *
122
- * @example
123
- * Logger.d("debug message") // [LOGGER DEBUG] > debug message
124
- * Logger.d("debug message", "DEBUG") // [DEBUG] > debug message
125
- *
126
- * @param {...any[]} msg debug messages
127
- * @returns {void}
128
- */
129
- Logger.d = function () {
130
- var arguments$1 = arguments;
131
-
132
- var args = [];
133
- for (var _i = 0; _i < arguments.length; _i++) {
134
- args[_i] = arguments$1[_i];
135
- }
136
- if (Logger.LOGGER_LEVEL < 1) {
137
- Logger.HIDE_TAG
138
- ? console.log.apply(console, args) : console.log.apply(console, __spreadArray(["%c[".concat(Logger.TAG, " DEBUG]"), 'background: #1677ff; color: #fff'], args, false));
139
- }
140
- };
141
- /**
142
- * @description Static method used to set logger option
143
- * @static
144
- *
145
- * @example
146
- * Logger.setOptions({level: 'INFO'}) // set logger level
87
+ * logger.setOptions({level: 'INFO'}) // set logger level
147
88
  *
148
89
  * @param {LoggerOptions} options logger options
149
90
  * @return {void}
150
91
  */
151
- Logger.setOptions = function (options) {
152
- Logger.LOGGER_LEVEL = Logger._matchLevel(options.level);
153
- Logger.HIDE_TAG = !!options.hideTag;
92
+ Logger.prototype.setOptions = function (options) {
93
+ this._options = options;
94
+ this._levelNum = this._matchLevel(options.level || 'DEBUG');
95
+ if (this._levelNum !== 0) {
96
+ this.e = this._loggerFactory('error', this._levelNum <= 4);
97
+ this.w = this._loggerFactory('warn', this._levelNum <= 3);
98
+ this.i = this._loggerFactory('info', this._levelNum <= 2);
99
+ this.v = this._loggerFactory('log', this._levelNum <= 1);
100
+ this.d = this._loggerFactory('warn', this._levelNum < 1);
101
+ }
154
102
  };
155
103
  /**
156
- * @description Static method used to match logger level
157
- * @static
104
+ * @description Private method used to match logger level
158
105
  * @private
159
106
  *
160
107
  * @example
161
- * Logger._matchLevel("DEBUG") // 0
108
+ * this._matchLevel("DEBUG") // 0
162
109
  *
163
110
  * @param {LoggerLevel} level logger level
164
111
  * @return {number}
165
112
  */
166
- Logger._matchLevel = function (level) {
113
+ Logger.prototype._matchLevel = function (level) {
167
114
  var logLevel = 0;
168
115
  switch (level) {
169
116
  case 'DEBUG':
@@ -184,10 +131,35 @@
184
131
  }
185
132
  return logLevel;
186
133
  };
187
- Logger.TAG = 'LOGGER';
188
- // log level default 0,
189
- Logger.LOGGER_LEVEL = 0;
190
- Logger.HIDE_TAG = false;
134
+ /**
135
+ * @private
136
+ * @description Logger factory
137
+ * @param {ConsoleKey} type
138
+ * @param {boolean} bool
139
+ * @returns
140
+ */
141
+ Logger.prototype._loggerFactory = function (type, bool) {
142
+ var func = console[type];
143
+ if (bool && func) {
144
+ return func.bind(console, "[".concat(type.toLocaleUpperCase(), "]"));
145
+ }
146
+ return Logger.noop;
147
+ };
148
+ /**
149
+ * @description Get options
150
+ * @returns {LoggerOptions}
151
+ */
152
+ Logger.prototype.getOptions = function () {
153
+ return this._options;
154
+ };
155
+ /**
156
+ * @description Get version
157
+ * @returns {string}
158
+ */
159
+ Logger.prototype.version = function () {
160
+ return '1.0.1';
161
+ };
162
+ Logger.noop = function () { };
191
163
  return Logger;
192
164
  }());
193
165
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@skax/logger",
3
- "version": "0.1.0",
3
+ "version": "1.0.1",
4
4
  "description": "console logger",
5
5
  "main": "index.js",
6
- "umd": "dist/index.umd.js",
6
+ "umd": "index.umd.js",
7
7
  "types": "types/index.d.ts",
8
8
  "repository": {
9
9
  "type": "git",
@@ -20,6 +20,6 @@
20
20
  },
21
21
  "homepage": "https://github.com/freeshineit/skax-logger#readme",
22
22
  "engines": {
23
- "node": ">=14"
23
+ "node": ">=16"
24
24
  }
25
25
  }
package/types/index.d.ts CHANGED
@@ -4,95 +4,113 @@ export type LoggerLevel = 'DEBUG' | 'VERBOSE' | 'INFO' | 'WARN' | 'ERROR';
4
4
  export interface LoggerOptions {
5
5
  /** logger level */
6
6
  level?: LoggerLevel;
7
- /** hidden tag prefix */
8
- hideTag?: boolean;
9
7
  }
8
+ export type LoggerFunc = (...data: any[]) => void;
10
9
  /**
11
- * @class Logger class
10
+ * @class Logger
12
11
  * @classdesc Provide multiple log printing methods
12
+ * @example
13
+ * const logger = new Logger({})
14
+ * logger.v("verbose log")
13
15
  */
14
16
  declare class Logger {
15
- private static readonly TAG;
16
- private static LOGGER_LEVEL;
17
- private static HIDE_TAG;
17
+ private static readonly noop;
18
+ private _options;
19
+ private _levelNum;
20
+ constructor(options?: LoggerOptions);
18
21
  /**
19
- * @description Static method used to print error logs
20
- * @static
22
+ * @description Method used to print error logs
23
+ * @method
21
24
  *
22
25
  * @example
23
- * Logger.e("error message") // [LOGGER ERROR] > error message
26
+ * logger.e("error message") // error message
24
27
  *
25
28
  * @param {...any[]} args error messages
26
29
  * @returns {void}
27
30
  */
28
- static e(...args: any[]): void;
31
+ e: LoggerFunc;
29
32
  /**
30
- * @description Static method used to print warn logs
31
- * @static
33
+ * @description Method used to print warn logs
34
+ * @method
32
35
  *
33
36
  * @example
34
- * Logger.w("warn message") // [LOGGER WARN] > warn message
37
+ * logger.w("warn message") // warn message
35
38
  *
36
39
  * @param {...any[]} args warn messages
37
40
  * @returns {void}
38
41
  */
39
- static w(...args: any[]): void;
42
+ w: LoggerFunc;
40
43
  /**
41
- * @description Static method used to print info logs
42
- * @static
44
+ * @description Method used to print info logs
45
+ * @method
43
46
  *
44
47
  * @example
45
- * Logger.i("info message") // [LOGGER INFO] > info message
48
+ * logger.i("info message") // info message
46
49
  *
47
50
  * @param {...any[]} args info messages
48
51
  * @returns {void}
49
52
  */
50
- static i(...args: any[]): void;
53
+ i: LoggerFunc;
51
54
  /**
52
- * @description Static method used to print verbose logs
53
- * @static
55
+ * @description Method used to print verbose logs
56
+ * @method
54
57
  *
55
58
  * @example
56
- * Logger.v("verbose message") // [LOGGER VERBOSE] > verbose message
59
+ * logger.v("verbose message") // verbose message
57
60
  *
58
61
  * @param {...any[]} args verbose messages
59
62
  * @returns {void}
60
63
  */
61
- static v(...args: any[]): void;
64
+ v: LoggerFunc;
62
65
  /**
63
- * @description Static method used to print debug logs
64
- * @static
66
+ * @description Method used to print debug logs
67
+ * @method
65
68
  *
66
69
  * @example
67
- * Logger.d("debug message") // [LOGGER DEBUG] > debug message
68
- * Logger.d("debug message", "DEBUG") // [DEBUG] > debug message
70
+ * logger.d("debug message") // debug message
69
71
  *
70
72
  * @param {...any[]} msg debug messages
71
73
  * @returns {void}
72
74
  */
73
- static d(...args: any[]): void;
75
+ d: LoggerFunc;
74
76
  /**
75
- * @description Static method used to set logger option
76
- * @static
77
+ * @description Method used to set logger option and change logger level
77
78
  *
78
79
  * @example
79
- * Logger.setOptions({level: 'INFO'}) // set logger level
80
+ * logger.setOptions({level: 'INFO'}) // set logger level
80
81
  *
81
82
  * @param {LoggerOptions} options logger options
82
83
  * @return {void}
83
84
  */
84
- static setOptions(options: LoggerOptions): void;
85
+ setOptions(options: Partial<LoggerOptions>): void;
85
86
  /**
86
- * @description Static method used to match logger level
87
- * @static
87
+ * @description Private method used to match logger level
88
88
  * @private
89
89
  *
90
90
  * @example
91
- * Logger._matchLevel("DEBUG") // 0
91
+ * this._matchLevel("DEBUG") // 0
92
92
  *
93
93
  * @param {LoggerLevel} level logger level
94
94
  * @return {number}
95
95
  */
96
- private static _matchLevel;
96
+ private _matchLevel;
97
+ /**
98
+ * @private
99
+ * @description Logger factory
100
+ * @param {ConsoleKey} type
101
+ * @param {boolean} bool
102
+ * @returns
103
+ */
104
+ private _loggerFactory;
105
+ /**
106
+ * @description Get options
107
+ * @returns {LoggerOptions}
108
+ */
109
+ getOptions(): Partial<LoggerOptions>;
110
+ /**
111
+ * @description Get version
112
+ * @returns {string}
113
+ */
114
+ version(): string;
97
115
  }
98
116
  export default Logger;