@nu-art/ts-common 0.102.117 → 0.102.119
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/core/logger/Logger.d.ts +16 -1
- package/core/logger/Logger.js +95 -2
- package/core/logger/Logger.js.map +1 -1
- package/package.json +11 -11
package/core/logger/Logger.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DebugFlag } from '../debug-flags';
|
|
2
2
|
import { LogLevel, LogParam } from './types';
|
|
3
3
|
export declare class Logger {
|
|
4
|
-
static readonly log: Logger;
|
|
5
4
|
private tag;
|
|
6
5
|
static defaultFlagState: boolean;
|
|
7
6
|
protected readonly _DEBUG_FLAG: DebugFlag;
|
|
@@ -21,3 +20,19 @@ export declare class Logger {
|
|
|
21
20
|
log(level: LogLevel, bold: boolean, toLog: LogParam[]): void;
|
|
22
21
|
private assertCanPrint;
|
|
23
22
|
}
|
|
23
|
+
export declare abstract class StaticLogger {
|
|
24
|
+
protected static readonly _DEBUG_FLAG: any;
|
|
25
|
+
static setMinLevel(minLevel: LogLevel): void;
|
|
26
|
+
static logVerbose(tag: string, ...toLog: LogParam[]): void;
|
|
27
|
+
static logDebug(tag: string, ...toLog: LogParam[]): void;
|
|
28
|
+
static logInfo(tag: string, ...toLog: LogParam[]): void;
|
|
29
|
+
static logWarning(tag: string, ...toLog: LogParam[]): void;
|
|
30
|
+
static logError(tag: string, ...toLog: LogParam[]): void;
|
|
31
|
+
static logVerboseBold(tag: string, ...toLog: LogParam[]): void;
|
|
32
|
+
static logDebugBold(tag: string, ...toLog: LogParam[]): void;
|
|
33
|
+
static logInfoBold(tag: string, ...toLog: LogParam[]): void;
|
|
34
|
+
static logWarningBold(tag: string, ...toLog: LogParam[]): void;
|
|
35
|
+
static logErrorBold(tag: string, ...toLog: LogParam[]): void;
|
|
36
|
+
static log(tag: string, level: LogLevel, bold: boolean, toLog: LogParam[]): void;
|
|
37
|
+
private static assertCanPrint;
|
|
38
|
+
}
|
package/core/logger/Logger.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.Logger = void 0;
|
|
20
|
+
exports.StaticLogger = exports.Logger = void 0;
|
|
21
21
|
var debug_flags_1 = require("../debug-flags");
|
|
22
22
|
var types_1 = require("./types");
|
|
23
23
|
var BeLogged_1 = require("./BeLogged");
|
|
@@ -115,9 +115,102 @@ var Logger = /** @class */ (function () {
|
|
|
115
115
|
return;
|
|
116
116
|
return this._DEBUG_FLAG.canLog(level);
|
|
117
117
|
};
|
|
118
|
-
Logger.log = new Logger('LOGGER');
|
|
119
118
|
Logger.defaultFlagState = true;
|
|
120
119
|
return Logger;
|
|
121
120
|
}());
|
|
122
121
|
exports.Logger = Logger;
|
|
122
|
+
var StaticLogger = /** @class */ (function () {
|
|
123
|
+
function StaticLogger() {
|
|
124
|
+
}
|
|
125
|
+
StaticLogger.setMinLevel = function (minLevel) {
|
|
126
|
+
this._DEBUG_FLAG.setMinLevel(minLevel);
|
|
127
|
+
};
|
|
128
|
+
StaticLogger.logVerbose = function (tag) {
|
|
129
|
+
var toLog = [];
|
|
130
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
131
|
+
toLog[_i - 1] = arguments[_i];
|
|
132
|
+
}
|
|
133
|
+
this.log(tag, types_1.LogLevel.Verbose, false, toLog);
|
|
134
|
+
};
|
|
135
|
+
StaticLogger.logDebug = function (tag) {
|
|
136
|
+
var toLog = [];
|
|
137
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
138
|
+
toLog[_i - 1] = arguments[_i];
|
|
139
|
+
}
|
|
140
|
+
this.log(tag, types_1.LogLevel.Debug, false, toLog);
|
|
141
|
+
};
|
|
142
|
+
StaticLogger.logInfo = function (tag) {
|
|
143
|
+
var toLog = [];
|
|
144
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
145
|
+
toLog[_i - 1] = arguments[_i];
|
|
146
|
+
}
|
|
147
|
+
this.log(tag, types_1.LogLevel.Info, false, toLog);
|
|
148
|
+
};
|
|
149
|
+
StaticLogger.logWarning = function (tag) {
|
|
150
|
+
var toLog = [];
|
|
151
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
152
|
+
toLog[_i - 1] = arguments[_i];
|
|
153
|
+
}
|
|
154
|
+
this.log(tag, types_1.LogLevel.Warning, false, toLog);
|
|
155
|
+
};
|
|
156
|
+
StaticLogger.logError = function (tag) {
|
|
157
|
+
var toLog = [];
|
|
158
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
159
|
+
toLog[_i - 1] = arguments[_i];
|
|
160
|
+
}
|
|
161
|
+
this.log(tag, types_1.LogLevel.Error, false, toLog);
|
|
162
|
+
};
|
|
163
|
+
StaticLogger.logVerboseBold = function (tag) {
|
|
164
|
+
var toLog = [];
|
|
165
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
166
|
+
toLog[_i - 1] = arguments[_i];
|
|
167
|
+
}
|
|
168
|
+
this.log(tag, types_1.LogLevel.Verbose, true, toLog);
|
|
169
|
+
};
|
|
170
|
+
StaticLogger.logDebugBold = function (tag) {
|
|
171
|
+
var toLog = [];
|
|
172
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
173
|
+
toLog[_i - 1] = arguments[_i];
|
|
174
|
+
}
|
|
175
|
+
this.log(tag, types_1.LogLevel.Debug, true, toLog);
|
|
176
|
+
};
|
|
177
|
+
StaticLogger.logInfoBold = function (tag) {
|
|
178
|
+
var toLog = [];
|
|
179
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
180
|
+
toLog[_i - 1] = arguments[_i];
|
|
181
|
+
}
|
|
182
|
+
this.log(tag, types_1.LogLevel.Info, true, toLog);
|
|
183
|
+
};
|
|
184
|
+
StaticLogger.logWarningBold = function (tag) {
|
|
185
|
+
var toLog = [];
|
|
186
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
187
|
+
toLog[_i - 1] = arguments[_i];
|
|
188
|
+
}
|
|
189
|
+
this.log(tag, types_1.LogLevel.Warning, true, toLog);
|
|
190
|
+
};
|
|
191
|
+
StaticLogger.logErrorBold = function (tag) {
|
|
192
|
+
var toLog = [];
|
|
193
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
194
|
+
toLog[_i - 1] = arguments[_i];
|
|
195
|
+
}
|
|
196
|
+
this.log(tag, types_1.LogLevel.Error, true, toLog);
|
|
197
|
+
};
|
|
198
|
+
StaticLogger.log = function (tag, level, bold, toLog) {
|
|
199
|
+
if (!this.assertCanPrint(level))
|
|
200
|
+
return;
|
|
201
|
+
// @ts-ignore
|
|
202
|
+
BeLogged_1.BeLogged.logImpl(tag, level, bold, toLog);
|
|
203
|
+
};
|
|
204
|
+
StaticLogger.assertCanPrint = function (level) {
|
|
205
|
+
if (!this._DEBUG_FLAG.isEnabled())
|
|
206
|
+
return;
|
|
207
|
+
return this._DEBUG_FLAG.canLog(level);
|
|
208
|
+
};
|
|
209
|
+
StaticLogger._DEBUG_FLAG = debug_flags_1.DebugFlags.createFlag('StaticLogger');
|
|
210
|
+
(function () {
|
|
211
|
+
StaticLogger._DEBUG_FLAG.enable(Logger.defaultFlagState);
|
|
212
|
+
})();
|
|
213
|
+
return StaticLogger;
|
|
214
|
+
}());
|
|
215
|
+
exports.StaticLogger = StaticLogger;
|
|
123
216
|
//# sourceMappingURL=Logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/main/core/logger/Logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,8CAAqD;AACrD,iCAA2C;AAC3C,uCAAoC;AAGpC;
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/main/core/logger/Logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,8CAAq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 -28,25 +28,25 @@
|
|
|
28
28
|
"mochaTest": "ts-mocha -p src/test/tsconfig.json src/test/__stam/compare/delete?.ts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"export-to-csv": "^0.2.1",
|
|
31
32
|
"moment": "^2.24.0",
|
|
32
|
-
"node-forge": "^1.2.1"
|
|
33
|
-
"export-to-csv": "^0.2.1"
|
|
33
|
+
"node-forge": "^1.2.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node-forge": "^1.0.0",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
38
36
|
"@types/chai": "^4.3.4",
|
|
39
|
-
"@types/mocha": "^10.0.1",
|
|
40
37
|
"@types/chai-as-promised": "^7.1.5",
|
|
38
|
+
"@types/mocha": "^10.0.1",
|
|
39
|
+
"@types/node-forge": "^1.0.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
41
|
+
"chai": "^4.3.7",
|
|
42
|
+
"chai-as-promised": "^7.1.1",
|
|
41
43
|
"csv-parser": "^2.3.3",
|
|
42
44
|
"eslint": "^6.8.0",
|
|
45
|
+
"mocha": "^10.2.0",
|
|
46
|
+
"ts-mocha": "^10.0.0",
|
|
43
47
|
"ts-node": "^8.6.2",
|
|
44
|
-
"typescript": "^4.5.0",
|
|
45
48
|
"typedoc": "^0.22",
|
|
46
|
-
"
|
|
47
|
-
"chai-as-promised": "^7.1.1",
|
|
48
|
-
"mocha": "^10.2.0",
|
|
49
|
-
"ts-mocha": "^10.0.0"
|
|
49
|
+
"typescript": "^4.5.0"
|
|
50
50
|
},
|
|
51
51
|
"_moduleAliases": {
|
|
52
52
|
"@main": "dist/main/ts",
|