@nu-art/ts-common 0.104.4 → 0.105.0
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 +8 -4
- package/consts/consts.d.ts +0 -1
- package/consts/consts.js +0 -22
- package/consts/consts.js.map +0 -1
- package/core/application.d.ts +0 -5
- package/core/application.js +0 -55
- package/core/application.js.map +0 -1
- package/core/debug-flags.d.ts +0 -25
- package/core/debug-flags.js +0 -87
- package/core/debug-flags.js.map +0 -1
- package/core/dispatcher.d.ts +0 -18
- package/core/dispatcher.js +0 -132
- package/core/dispatcher.js.map +0 -1
- package/core/error-handling.d.ts +0 -14
- package/core/error-handling.js +0 -38
- package/core/error-handling.js.map +0 -1
- package/core/exceptions.d.ts +0 -118
- package/core/exceptions.js +0 -214
- package/core/exceptions.js.map +0 -1
- package/core/logger/BeLogged.d.ts +0 -14
- package/core/logger/BeLogged.js +0 -61
- package/core/logger/BeLogged.js.map +0 -1
- package/core/logger/LogClient.d.ts +0 -14
- package/core/logger/LogClient.js +0 -67
- package/core/logger/LogClient.js.map +0 -1
- package/core/logger/LogClient_BaseRotate.d.ts +0 -19
- package/core/logger/LogClient_BaseRotate.js +0 -80
- package/core/logger/LogClient_BaseRotate.js.map +0 -1
- package/core/logger/LogClient_Browser.d.ts +0 -9
- package/core/logger/LogClient_Browser.js +0 -101
- package/core/logger/LogClient_Browser.js.map +0 -1
- package/core/logger/LogClient_Function.d.ts +0 -8
- package/core/logger/LogClient_Function.js +0 -75
- package/core/logger/LogClient_Function.js.map +0 -1
- package/core/logger/LogClient_MemBuffer.d.ts +0 -9
- package/core/logger/LogClient_MemBuffer.js +0 -61
- package/core/logger/LogClient_MemBuffer.js.map +0 -1
- package/core/logger/LogClient_Terminal.d.ts +0 -9
- package/core/logger/LogClient_Terminal.js +0 -75
- package/core/logger/LogClient_Terminal.js.map +0 -1
- package/core/logger/Logger.d.ts +0 -38
- package/core/logger/Logger.js +0 -216
- package/core/logger/Logger.js.map +0 -1
- package/core/logger/types.d.ts +0 -10
- package/core/logger/types.js +0 -36
- package/core/logger/types.js.map +0 -1
- package/core/logger/utils.d.ts +0 -5
- package/core/logger/utils.js +0 -80
- package/core/logger/utils.js.map +0 -1
- package/core/module-manager.d.ts +0 -18
- package/core/module-manager.js +0 -112
- package/core/module-manager.js.map +0 -1
- package/core/module.d.ts +0 -32
- package/core/module.js +0 -126
- package/core/module.js.map +0 -1
- package/csv.d.ts +0 -1
- package/csv.js +0 -35
- package/csv.js.map +0 -1
- package/index.d.ts +0 -43
- package/index.js +0 -77
- package/index.js.map +0 -1
- package/modules/CSVModule.d.ts +0 -32
- package/modules/CSVModule.js +0 -165
- package/modules/CSVModule.js.map +0 -1
- package/modules/CliParamsModule.d.ts +0 -27
- package/modules/CliParamsModule.js +0 -94
- package/modules/CliParamsModule.js.map +0 -1
- package/modules/csv-serializer.d.ts +0 -11
- package/modules/csv-serializer.js +0 -50
- package/modules/csv-serializer.js.map +0 -1
- package/permissions/permission-group.d.ts +0 -8
- package/permissions/permission-group.js +0 -37
- package/permissions/permission-group.js.map +0 -1
- package/test-index.d.ts +0 -2
- package/test-index.js +0 -19
- package/test-index.js.map +0 -1
- package/testing/consts.d.ts +0 -5
- package/testing/consts.js +0 -74
- package/testing/consts.js.map +0 -1
- package/testing/types.d.ts +0 -16
- package/testing/types.js +0 -20
- package/testing/types.js.map +0 -1
- package/tools/Replacer.d.ts +0 -24
- package/tools/Replacer.js +0 -172
- package/tools/Replacer.js.map +0 -1
- package/tools/get-log-style.d.ts +0 -14
- package/tools/get-log-style.js +0 -43
- package/tools/get-log-style.js.map +0 -1
- package/utils/array-tools.d.ts +0 -85
- package/utils/array-tools.js +0 -302
- package/utils/array-tools.js.map +0 -1
- package/utils/crypto-tools.d.ts +0 -4
- package/utils/crypto-tools.js +0 -36
- package/utils/crypto-tools.js.map +0 -1
- package/utils/date-time-tools.d.ts +0 -28
- package/utils/date-time-tools.js +0 -180
- package/utils/date-time-tools.js.map +0 -1
- package/utils/db-object-tools.d.ts +0 -3
- package/utils/db-object-tools.js +0 -9
- package/utils/db-object-tools.js.map +0 -1
- package/utils/filter-tools.d.ts +0 -137
- package/utils/filter-tools.js +0 -217
- package/utils/filter-tools.js.map +0 -1
- package/utils/hash-tools.d.ts +0 -8
- package/utils/hash-tools.js +0 -60
- package/utils/hash-tools.js.map +0 -1
- package/utils/merge-tools.d.ts +0 -3
- package/utils/merge-tools.js +0 -71
- package/utils/merge-tools.js.map +0 -1
- package/utils/mimetype-tools.d.ts +0 -8
- package/utils/mimetype-tools.js +0 -29
- package/utils/mimetype-tools.js.map +0 -1
- package/utils/number-tools.d.ts +0 -1
- package/utils/number-tools.js +0 -26
- package/utils/number-tools.js.map +0 -1
- package/utils/object-tools.d.ts +0 -13
- package/utils/object-tools.js +0 -129
- package/utils/object-tools.js.map +0 -1
- package/utils/query-params.d.ts +0 -5
- package/utils/query-params.js +0 -24
- package/utils/query-params.js.map +0 -1
- package/utils/queue.d.ts +0 -16
- package/utils/queue.js +0 -166
- package/utils/queue.js.map +0 -1
- package/utils/random-tools.d.ts +0 -2
- package/utils/random-tools.js +0 -35
- package/utils/random-tools.js.map +0 -1
- package/utils/storage-capacity-tools.d.ts +0 -6
- package/utils/storage-capacity-tools.js +0 -27
- package/utils/storage-capacity-tools.js.map +0 -1
- package/utils/string-tools.d.ts +0 -10
- package/utils/string-tools.js +0 -100
- package/utils/string-tools.js.map +0 -1
- package/utils/tools.d.ts +0 -13
- package/utils/tools.js +0 -103
- package/utils/tools.js.map +0 -1
- package/utils/types.d.ts +0 -92
- package/utils/types.js +0 -23
- package/utils/types.js.map +0 -1
- package/utils/version-tools.d.ts +0 -10
- package/utils/version-tools.js +0 -51
- package/utils/version-tools.js.map +0 -1
- package/validator/type-validators.d.ts +0 -29
- package/validator/type-validators.js +0 -211
- package/validator/type-validators.js.map +0 -1
- package/validator/validator-core.d.ts +0 -36
- package/validator/validator-core.js +0 -144
- package/validator/validator-core.js.map +0 -1
package/core/exceptions.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
-
*
|
|
5
|
-
* Copyright (C) 2020 Adam van der Kruk aka TacB0sS
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Created by TacB0sS on 3/16/17.
|
|
21
|
-
*/
|
|
22
|
-
var __extends = (this && this.__extends) || (function () {
|
|
23
|
-
var extendStatics = function (d, b) {
|
|
24
|
-
extendStatics = Object.setPrototypeOf ||
|
|
25
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
26
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
27
|
-
return extendStatics(d, b);
|
|
28
|
-
};
|
|
29
|
-
return function (d, b) {
|
|
30
|
-
if (typeof b !== "function" && b !== null)
|
|
31
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
32
|
-
extendStatics(d, b);
|
|
33
|
-
function __() { this.constructor = d; }
|
|
34
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
35
|
-
};
|
|
36
|
-
})();
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.AssertionException = exports.WhoCallthisException = exports.DontCallthisException = exports.ThisShouldNotHappenException = exports.NotImplementedYetException = exports.MUSTNeverHappenException = exports.ImplementationMissingException = exports.BadImplementationException = exports.Exception = exports.CustomException = exports.isErrorOfType = void 0;
|
|
39
|
-
/**
|
|
40
|
-
* # <ins>isErrorOfType</ins>
|
|
41
|
-
*
|
|
42
|
-
* A function that checks if an error is of a certain type.
|
|
43
|
-
*
|
|
44
|
-
* @param e The error
|
|
45
|
-
* @param _exceptionType The exception class to compare to
|
|
46
|
-
*
|
|
47
|
-
* @returns
|
|
48
|
-
* - T - The error as the type checked if the error was of that type.
|
|
49
|
-
* - undefined - otherwise.
|
|
50
|
-
*
|
|
51
|
-
* #### <ins>Usage:</ins>
|
|
52
|
-
* ```js
|
|
53
|
-
* try {
|
|
54
|
-
* ...
|
|
55
|
-
* } catch(e: Error) {
|
|
56
|
-
* if(isErrorOfType(e,ThisShouldNotHappenException)) {
|
|
57
|
-
* e = new ThisShouldNotHappenException("this should not have happened",e);
|
|
58
|
-
* ...
|
|
59
|
-
* }
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
function isErrorOfType(e, _exceptionType) {
|
|
64
|
-
var _a;
|
|
65
|
-
var _e = e;
|
|
66
|
-
if ((_a = _e.isInstanceOf) === null || _a === void 0 ? void 0 : _a.call(_e, _exceptionType))
|
|
67
|
-
return e;
|
|
68
|
-
}
|
|
69
|
-
exports.isErrorOfType = isErrorOfType;
|
|
70
|
-
/**
|
|
71
|
-
* # CustomException
|
|
72
|
-
*
|
|
73
|
-
* ### <ins>Intro</ins>
|
|
74
|
-
* An abstract class defining the structure of custom exceptions.<br>
|
|
75
|
-
* This class extends the java-script native Error object.<br>
|
|
76
|
-
* In addition to collecting the error, this class also collects a message and the exception type, for better
|
|
77
|
-
* error handling.<br>
|
|
78
|
-
*
|
|
79
|
-
* @category Exceptions
|
|
80
|
-
*/
|
|
81
|
-
var CustomException = /** @class */ (function (_super) {
|
|
82
|
-
__extends(CustomException, _super);
|
|
83
|
-
function CustomException(exceptionType, message, cause) {
|
|
84
|
-
var _this = _super.call(this, message) || this;
|
|
85
|
-
_this.message = message;
|
|
86
|
-
_this.stack = (new Error(message)).stack;
|
|
87
|
-
_this.cause = cause;
|
|
88
|
-
_this.exceptionType = exceptionType.name;
|
|
89
|
-
_this.isInstanceOf = function (_exceptionType) {
|
|
90
|
-
return _this.exceptionType === _exceptionType.name;
|
|
91
|
-
};
|
|
92
|
-
return _this;
|
|
93
|
-
}
|
|
94
|
-
return CustomException;
|
|
95
|
-
}(Error));
|
|
96
|
-
exports.CustomException = CustomException;
|
|
97
|
-
/**
|
|
98
|
-
* # <ins>Exception</ins>
|
|
99
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "Exception",
|
|
100
|
-
* @category Exceptions
|
|
101
|
-
*/
|
|
102
|
-
var Exception = /** @class */ (function (_super) {
|
|
103
|
-
__extends(Exception, _super);
|
|
104
|
-
function Exception(message, cause) {
|
|
105
|
-
return _super.call(this, Exception, message, cause) || this;
|
|
106
|
-
}
|
|
107
|
-
return Exception;
|
|
108
|
-
}(CustomException));
|
|
109
|
-
exports.Exception = Exception;
|
|
110
|
-
/**
|
|
111
|
-
* # <ins>BadImplementationException</ins>
|
|
112
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "BadImplementationException",
|
|
113
|
-
* @category Exceptions
|
|
114
|
-
*/
|
|
115
|
-
var BadImplementationException = /** @class */ (function (_super) {
|
|
116
|
-
__extends(BadImplementationException, _super);
|
|
117
|
-
function BadImplementationException(message, cause) {
|
|
118
|
-
return _super.call(this, BadImplementationException, message, cause) || this;
|
|
119
|
-
}
|
|
120
|
-
return BadImplementationException;
|
|
121
|
-
}(CustomException));
|
|
122
|
-
exports.BadImplementationException = BadImplementationException;
|
|
123
|
-
/**
|
|
124
|
-
* # <ins>ImplementationMissingException</ins>
|
|
125
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "ImplementationMissingException",
|
|
126
|
-
* @category Exceptions
|
|
127
|
-
*/
|
|
128
|
-
var ImplementationMissingException = /** @class */ (function (_super) {
|
|
129
|
-
__extends(ImplementationMissingException, _super);
|
|
130
|
-
function ImplementationMissingException(message, cause) {
|
|
131
|
-
return _super.call(this, ImplementationMissingException, message, cause) || this;
|
|
132
|
-
}
|
|
133
|
-
return ImplementationMissingException;
|
|
134
|
-
}(CustomException));
|
|
135
|
-
exports.ImplementationMissingException = ImplementationMissingException;
|
|
136
|
-
/**
|
|
137
|
-
* # <ins>MUSTNeverHappenException</ins>
|
|
138
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "MUSTNeverHappenException",
|
|
139
|
-
* @category Exceptions
|
|
140
|
-
*/
|
|
141
|
-
var MUSTNeverHappenException = /** @class */ (function (_super) {
|
|
142
|
-
__extends(MUSTNeverHappenException, _super);
|
|
143
|
-
function MUSTNeverHappenException(message, cause) {
|
|
144
|
-
return _super.call(this, MUSTNeverHappenException, message, cause) || this;
|
|
145
|
-
}
|
|
146
|
-
return MUSTNeverHappenException;
|
|
147
|
-
}(CustomException));
|
|
148
|
-
exports.MUSTNeverHappenException = MUSTNeverHappenException;
|
|
149
|
-
/**
|
|
150
|
-
* # <ins>NotImplementedYetException</ins>
|
|
151
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "NotImplementedYetException",
|
|
152
|
-
* @category Exceptions
|
|
153
|
-
*/
|
|
154
|
-
var NotImplementedYetException = /** @class */ (function (_super) {
|
|
155
|
-
__extends(NotImplementedYetException, _super);
|
|
156
|
-
function NotImplementedYetException(message, cause) {
|
|
157
|
-
return _super.call(this, NotImplementedYetException, message, cause) || this;
|
|
158
|
-
}
|
|
159
|
-
return NotImplementedYetException;
|
|
160
|
-
}(CustomException));
|
|
161
|
-
exports.NotImplementedYetException = NotImplementedYetException;
|
|
162
|
-
/**
|
|
163
|
-
* # <ins>ThisShouldNotHappenException</ins>
|
|
164
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "ThisShouldNotHappenException",
|
|
165
|
-
* @category Exceptions
|
|
166
|
-
*/
|
|
167
|
-
var ThisShouldNotHappenException = /** @class */ (function (_super) {
|
|
168
|
-
__extends(ThisShouldNotHappenException, _super);
|
|
169
|
-
function ThisShouldNotHappenException(message, cause) {
|
|
170
|
-
return _super.call(this, ThisShouldNotHappenException, message, cause) || this;
|
|
171
|
-
}
|
|
172
|
-
return ThisShouldNotHappenException;
|
|
173
|
-
}(CustomException));
|
|
174
|
-
exports.ThisShouldNotHappenException = ThisShouldNotHappenException;
|
|
175
|
-
/**
|
|
176
|
-
* # <ins>DontCallthisException</ins>
|
|
177
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "DontCallthisException",
|
|
178
|
-
* @category Exceptions
|
|
179
|
-
*/
|
|
180
|
-
var DontCallthisException = /** @class */ (function (_super) {
|
|
181
|
-
__extends(DontCallthisException, _super);
|
|
182
|
-
function DontCallthisException(message, cause) {
|
|
183
|
-
return _super.call(this, DontCallthisException, message, cause) || this;
|
|
184
|
-
}
|
|
185
|
-
return DontCallthisException;
|
|
186
|
-
}(CustomException));
|
|
187
|
-
exports.DontCallthisException = DontCallthisException;
|
|
188
|
-
/**
|
|
189
|
-
* # <ins>WhoCallthisException</ins>
|
|
190
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "WhoCallthisException",
|
|
191
|
-
* @category Exceptions
|
|
192
|
-
*/
|
|
193
|
-
var WhoCallthisException = /** @class */ (function (_super) {
|
|
194
|
-
__extends(WhoCallthisException, _super);
|
|
195
|
-
function WhoCallthisException(message, cause) {
|
|
196
|
-
return _super.call(this, WhoCallthisException, message, cause) || this;
|
|
197
|
-
}
|
|
198
|
-
return WhoCallthisException;
|
|
199
|
-
}(CustomException));
|
|
200
|
-
exports.WhoCallthisException = WhoCallthisException;
|
|
201
|
-
/**
|
|
202
|
-
* # <ins>AssertionException</ins>
|
|
203
|
-
* This class inherits {@link CustomException} and functions like it, after setting the exceptionType property as "AssertionException",
|
|
204
|
-
* @category Exceptions
|
|
205
|
-
*/
|
|
206
|
-
var AssertionException = /** @class */ (function (_super) {
|
|
207
|
-
__extends(AssertionException, _super);
|
|
208
|
-
function AssertionException(message, cause) {
|
|
209
|
-
return _super.call(this, AssertionException, message, cause) || this;
|
|
210
|
-
}
|
|
211
|
-
return AssertionException;
|
|
212
|
-
}(CustomException));
|
|
213
|
-
exports.AssertionException = AssertionException;
|
|
214
|
-
//# sourceMappingURL=exceptions.js.map
|
package/core/exceptions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../src/main/core/exceptions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;AACH;;GAEG;;;;;;;;;;;;;;;;;;AAMH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,aAAa,CAAkB,CAAQ,EAAE,cAA8B;;IACnF,IAAM,EAAE,GAAG,CAAQ,CAAC;IACpB,IAAI,MAAA,EAAE,CAAC,YAAY,mDAAG,cAAc,CAAC;QACjC,OAAO,CAAM,CAAC;AACtB,CAAC;AAJD,sCAIC;AAED;;;;;;;;;;GAUG;AACH;IACY,mCAAK;IAOb,yBAAsB,aAAuB,EAAE,OAAe,EAAE,KAAa;QAA7E,YACI,kBAAM,OAAO,CAAC,SAQjB;QAPG,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QACxC,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC;QACxC,KAAI,CAAC,YAAY,GAAG,UAAC,cAAwB;YACzC,OAAO,KAAI,CAAC,aAAa,KAAK,cAAc,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC;;IACN,CAAC;IACL,s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;IAEvB,+BAAY,OAAe,EAAE,KAAa;eACtC,kBAAM,qBAAqB,EAAE,OAAO,EAAE,KAAK,CAAC;IAChD,CAAC;IACL,4BAAC;AAAD,CAAC,AAND,CACY,eAAe,GAK1B;AANY,sDAAqB;AAQlC;;;;GAIG;AACH;IACY,wCAAe;IAEvB,8BAAY,OAAe,EAAE,KAAa;eACtC,kBAAM,oBAAoB,EAAE,OAAO,EAAE,KAAK,CAAC;IAC/C,CAAC;IACL,2BAAC;AAAD,CAAC,AAND,CACY,eAAe,GAK1B;AANY,oDAAoB;AAQjC;;;;GAIG;AACH;IACY,sCAAe;IAEvB,4BAAY,OAAe,EAAE,KAAa;eACtC,kBAAM,kBAAkB,EAAE,OAAO,EAAE,KAAK,CAAC;IAC7C,CAAC;IACL,yBAAC;AAAD,CAAC,AAND,CACY,eAAe,GAK1B;AANY,gDAAkB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LogClient } from "./LogClient";
|
|
2
|
-
import { LogLevel, LogParam } from "./types";
|
|
3
|
-
declare class BeLogged_Class {
|
|
4
|
-
private clients;
|
|
5
|
-
private lineCount;
|
|
6
|
-
addClient<Client extends LogClient>(client: Client): void;
|
|
7
|
-
removeConsole<Client extends LogClient>(client: Client): void;
|
|
8
|
-
log(tag: string, level: LogLevel, bold: boolean, ...toLog: LogParam[]): void;
|
|
9
|
-
private logImpl;
|
|
10
|
-
clearFooter(): void;
|
|
11
|
-
rewriteConsole(lineCount: number): void;
|
|
12
|
-
}
|
|
13
|
-
export declare const BeLogged: BeLogged_Class;
|
|
14
|
-
export {};
|
package/core/logger/BeLogged.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
-
*
|
|
5
|
-
* Copyright (C) 2020 Adam van der Kruk aka TacB0sS
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.BeLogged = void 0;
|
|
21
|
-
var array_tools_1 = require("../../utils/array-tools");
|
|
22
|
-
var BeLogged_Class = /** @class */ (function () {
|
|
23
|
-
function BeLogged_Class() {
|
|
24
|
-
this.clients = [];
|
|
25
|
-
this.lineCount = 0;
|
|
26
|
-
}
|
|
27
|
-
BeLogged_Class.prototype.addClient = function (client) {
|
|
28
|
-
if (this.clients.indexOf(client) !== -1)
|
|
29
|
-
return;
|
|
30
|
-
this.clients.push(client);
|
|
31
|
-
};
|
|
32
|
-
BeLogged_Class.prototype.removeConsole = function (client) {
|
|
33
|
-
if (this.clients.indexOf(client) === -1)
|
|
34
|
-
return;
|
|
35
|
-
(0, array_tools_1.removeItemFromArray)(this.clients, client);
|
|
36
|
-
};
|
|
37
|
-
BeLogged_Class.prototype.log = function (tag, level, bold) {
|
|
38
|
-
var toLog = [];
|
|
39
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
40
|
-
toLog[_i - 3] = arguments[_i];
|
|
41
|
-
}
|
|
42
|
-
this.logImpl(tag, level, bold, toLog);
|
|
43
|
-
};
|
|
44
|
-
BeLogged_Class.prototype.logImpl = function (tag, level, bold, toLog) {
|
|
45
|
-
for (var _i = 0, _a = this.clients; _i < _a.length; _i++) {
|
|
46
|
-
var client = _a[_i];
|
|
47
|
-
client.log(tag, level, bold, toLog);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
BeLogged_Class.prototype.clearFooter = function () {
|
|
51
|
-
for (var i = 0; i < this.lineCount + 3; i++) {
|
|
52
|
-
process.stdout.write("\n");
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
BeLogged_Class.prototype.rewriteConsole = function (lineCount) {
|
|
56
|
-
this.lineCount = lineCount;
|
|
57
|
-
};
|
|
58
|
-
return BeLogged_Class;
|
|
59
|
-
}());
|
|
60
|
-
exports.BeLogged = new BeLogged_Class();
|
|
61
|
-
//# sourceMappingURL=BeLogged.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BeLogged.js","sourceRoot":"","sources":["../../../src/main/core/logger/BeLogged.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAIH,uDAA4D;AAM5D;IAAA;QAES,YAAO,GAAgB,EAAE,CAAC;QAC1B,cAAS,GAAG,CAAC,CAAC;IAoCvB,CAAC;IAlCO,kCAAS,GAAhB,UAA2C,MAAc;QACxD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtC,OAAO;QAER,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAEM,sCAAa,GAApB,UAA+C,MAAc;QAC5D,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtC,OAAO;QAER,IAAA,iCAAmB,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEM,4BAAG,GAAV,UAAW,GAAW,EAAE,KAAe,EAAE,IAAa;QAAE,eAAoB;aAApB,UAAoB,EAApB,qBAAoB,EAApB,IAAoB;YAApB,8BAAoB;;QAC3E,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAEO,gCAAO,GAAf,UAAgB,GAAW,EAAE,KAAe,EAAE,IAAa,EAAE,KAAiB;QAC7E,KAAqB,UAAY,EAAZ,KAAA,IAAI,CAAC,OAAO,EAAZ,cAAY,EAAZ,IAAY,EAAE;YAA9B,IAAM,MAAM,SAAA;YAChB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SACpC;IACF,CAAC;IAGM,oCAAW,GAAlB;QACC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC3B;IACF,CAAC;IAEM,uCAAc,GAArB,UAAsB,SAAiB;QACtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IACF,qBAAC;AAAD,CAAC,AAvCD,IAuCC;AAEY,QAAA,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LogLevel, LogParam, LogPrefixComposer } from "./types";
|
|
2
|
-
export type LogFilter = (level: LogLevel, tag: string) => boolean;
|
|
3
|
-
export declare abstract class LogClient {
|
|
4
|
-
private prefixComposer;
|
|
5
|
-
private filter;
|
|
6
|
-
protected abstract logMessage(level: LogLevel, bold: boolean, prefix: string, ...toLog: LogParam[]): void;
|
|
7
|
-
setComposer(logComposer: LogPrefixComposer): void;
|
|
8
|
-
setFilter(filter: LogFilter): this;
|
|
9
|
-
log(tag: string, level: LogLevel, bold: boolean, toLog: LogParam[]): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const _logger_timezoneOffset: number;
|
|
12
|
-
export declare const _logger_finalDate: Date;
|
|
13
|
-
export declare function _logger_getPrefix(level: LogLevel): "-V-" | "-D-" | "-I-" | "-W-" | "-E-" | "---";
|
|
14
|
-
export declare const DefaultLogPrefixComposer: LogPrefixComposer;
|
package/core/logger/LogClient.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
-
*
|
|
5
|
-
* Copyright (C) 2020 Adam van der Kruk aka TacB0sS
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.DefaultLogPrefixComposer = exports._logger_getPrefix = exports._logger_finalDate = exports._logger_timezoneOffset = exports.LogClient = void 0;
|
|
21
|
-
var types_1 = require("./types");
|
|
22
|
-
var LogClient = /** @class */ (function () {
|
|
23
|
-
function LogClient() {
|
|
24
|
-
this.prefixComposer = exports.DefaultLogPrefixComposer;
|
|
25
|
-
this.filter = function () { return true; };
|
|
26
|
-
}
|
|
27
|
-
LogClient.prototype.setComposer = function (logComposer) {
|
|
28
|
-
this.prefixComposer = logComposer;
|
|
29
|
-
};
|
|
30
|
-
LogClient.prototype.setFilter = function (filter) {
|
|
31
|
-
this.filter = filter;
|
|
32
|
-
return this;
|
|
33
|
-
};
|
|
34
|
-
LogClient.prototype.log = function (tag, level, bold, toLog) {
|
|
35
|
-
if (!this.filter(level, tag))
|
|
36
|
-
return;
|
|
37
|
-
this.logMessage(level, bold, this.prefixComposer(tag, level), toLog);
|
|
38
|
-
};
|
|
39
|
-
return LogClient;
|
|
40
|
-
}());
|
|
41
|
-
exports.LogClient = LogClient;
|
|
42
|
-
exports._logger_timezoneOffset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds
|
|
43
|
-
exports._logger_finalDate = new Date();
|
|
44
|
-
function _logger_getPrefix(level) {
|
|
45
|
-
switch (level) {
|
|
46
|
-
case types_1.LogLevel.Verbose:
|
|
47
|
-
return '-V-';
|
|
48
|
-
case types_1.LogLevel.Debug:
|
|
49
|
-
return '-D-';
|
|
50
|
-
case types_1.LogLevel.Info:
|
|
51
|
-
return '-I-';
|
|
52
|
-
case types_1.LogLevel.Warning:
|
|
53
|
-
return '-W-';
|
|
54
|
-
case types_1.LogLevel.Error:
|
|
55
|
-
return '-E-';
|
|
56
|
-
default:
|
|
57
|
-
return '---';
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports._logger_getPrefix = _logger_getPrefix;
|
|
61
|
-
var DefaultLogPrefixComposer = function (tag, level) {
|
|
62
|
-
exports._logger_finalDate.setTime(Date.now() - exports._logger_timezoneOffset);
|
|
63
|
-
var date = exports._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23);
|
|
64
|
-
return " ".concat(date, " ").concat(_logger_getPrefix(level), " ").concat(tag, ": ");
|
|
65
|
-
};
|
|
66
|
-
exports.DefaultLogPrefixComposer = DefaultLogPrefixComposer;
|
|
67
|
-
//# sourceMappingURL=LogClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogClient.js","sourceRoot":"","sources":["../../../src/main/core/logger/LogClient.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,iCAIiB;AAIjB;IAAA;QAES,mBAAc,GAAsB,gCAAwB,CAAC;QAC7D,WAAM,GAAc,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;IAmBxC,CAAC;IAfO,+BAAW,GAAlB,UAAmB,WAA8B;QAChD,IAAI,CAAC,cAA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AC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACjG,OAAO,YAAK,IAAI,cAAI,iBAAiB,CAAC,KAAK,CAAC,cAAI,GAAG,QAAK,CAAC;AAC1D,CAAC,CAAC;AAJW,QAAA,wBAAwB,4BAInC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { LogClient } from "./LogClient";
|
|
2
|
-
import { LogLevel, LogParam } from "./types";
|
|
3
|
-
type LogRotateListener = () => void;
|
|
4
|
-
export declare abstract class LogClient_BaseRotate extends LogClient {
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly maxEntries: number;
|
|
7
|
-
readonly maxSize: number;
|
|
8
|
-
protected bufferSize: number;
|
|
9
|
-
private rotationListener?;
|
|
10
|
-
protected constructor(name: string, maxEntries?: number, maxSize?: number);
|
|
11
|
-
protected logMessage(level: LogLevel, bold: boolean, prefix: string, toLog: LogParam[]): void;
|
|
12
|
-
setRotationListener(rotationListener: LogRotateListener): this;
|
|
13
|
-
protected abstract printLogMessage(log: string): void;
|
|
14
|
-
private rotate;
|
|
15
|
-
protected abstract cleanup(): void;
|
|
16
|
-
protected abstract prepare(): void;
|
|
17
|
-
protected abstract rotateBuffer(fromIndex: number, toIndex: number): void;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Permissions management system, define access level for each of
|
|
4
|
-
* your server apis, and restrict users by giving them access levels
|
|
5
|
-
*
|
|
6
|
-
* Copyright (C) 2020 Adam van der Kruk aka TacB0sS
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
var __extends = (this && this.__extends) || (function () {
|
|
21
|
-
var extendStatics = function (d, b) {
|
|
22
|
-
extendStatics = Object.setPrototypeOf ||
|
|
23
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
24
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
25
|
-
return extendStatics(d, b);
|
|
26
|
-
};
|
|
27
|
-
return function (d, b) {
|
|
28
|
-
if (typeof b !== "function" && b !== null)
|
|
29
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
30
|
-
extendStatics(d, b);
|
|
31
|
-
function __() { this.constructor = d; }
|
|
32
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.LogClient_BaseRotate = void 0;
|
|
37
|
-
var LogClient_1 = require("./LogClient");
|
|
38
|
-
var utils_1 = require("./utils");
|
|
39
|
-
var LogClient_BaseRotate = /** @class */ (function (_super) {
|
|
40
|
-
__extends(LogClient_BaseRotate, _super);
|
|
41
|
-
function LogClient_BaseRotate(name, maxEntries, maxSize) {
|
|
42
|
-
if (maxEntries === void 0) { maxEntries = 10; }
|
|
43
|
-
if (maxSize === void 0) { maxSize = 1024 * 1024; }
|
|
44
|
-
var _this = _super.call(this) || this;
|
|
45
|
-
_this.bufferSize = 0;
|
|
46
|
-
_this.name = name;
|
|
47
|
-
_this.maxSize = maxSize;
|
|
48
|
-
_this.maxEntries = maxEntries;
|
|
49
|
-
return _this;
|
|
50
|
-
}
|
|
51
|
-
LogClient_BaseRotate.prototype.logMessage = function (level, bold, prefix, toLog) {
|
|
52
|
-
var toLogAsString = (0, utils_1._logger_convertLogParamsToStrings)(toLog);
|
|
53
|
-
this.rotate();
|
|
54
|
-
for (var _i = 0, toLogAsString_1 = toLogAsString; _i < toLogAsString_1.length; _i++) {
|
|
55
|
-
var paramAsString = toLogAsString_1[_i];
|
|
56
|
-
var log = paramAsString + "\n";
|
|
57
|
-
this.printLogMessage(log);
|
|
58
|
-
this.bufferSize += log.length;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
LogClient_BaseRotate.prototype.setRotationListener = function (rotationListener) {
|
|
62
|
-
this.rotationListener = rotationListener;
|
|
63
|
-
return this;
|
|
64
|
-
};
|
|
65
|
-
LogClient_BaseRotate.prototype.rotate = function () {
|
|
66
|
-
var _a;
|
|
67
|
-
if (this.bufferSize < this.maxSize)
|
|
68
|
-
return;
|
|
69
|
-
this.cleanup();
|
|
70
|
-
for (var i = this.maxEntries - 1; i > 0; i--) {
|
|
71
|
-
this.rotateBuffer(i - 1, i);
|
|
72
|
-
}
|
|
73
|
-
(_a = this.rotationListener) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
74
|
-
this.bufferSize = 0;
|
|
75
|
-
this.prepare();
|
|
76
|
-
};
|
|
77
|
-
return LogClient_BaseRotate;
|
|
78
|
-
}(LogClient_1.LogClient));
|
|
79
|
-
exports.LogClient_BaseRotate = LogClient_BaseRotate;
|
|
80
|
-
//# sourceMappingURL=LogClient_BaseRotate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogClient_BaseRotate.js","sourceRoot":"","sources":["../../../src/main/core/logger/LogClient_BaseRotate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;AAEH,yCAAsC;AAKtC,iCAA0D;AAI1D;IACS,wCAAS;IAUjB,8B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G,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAQF,2BAAC;AAAD,CAAC,AAxDD,CACS,qBAAS,GAuDjB;AAxDqB,oDAAoB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { LogLevel, LogParam } from './types';
|
|
2
|
-
import { LogClient } from './LogClient';
|
|
3
|
-
declare class LogClient_Browser_class extends LogClient {
|
|
4
|
-
private style;
|
|
5
|
-
getColor(level: LogLevel, bold: boolean): string;
|
|
6
|
-
protected logMessage(level: LogLevel, bold: boolean, prefix: string, toLog: LogParam[]): void;
|
|
7
|
-
}
|
|
8
|
-
export declare const LogClient_Browser: LogClient_Browser_class;
|
|
9
|
-
export {};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* ts-common is the basic building blocks of our typescript projects
|
|
4
|
-
*
|
|
5
|
-
* Copyright (C) 2020 Adam van der Kruk aka TacB0sS
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
var __extends = (this && this.__extends) || (function () {
|
|
20
|
-
var extendStatics = function (d, b) {
|
|
21
|
-
extendStatics = Object.setPrototypeOf ||
|
|
22
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
24
|
-
return extendStatics(d, b);
|
|
25
|
-
};
|
|
26
|
-
return function (d, b) {
|
|
27
|
-
if (typeof b !== "function" && b !== null)
|
|
28
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
29
|
-
extendStatics(d, b);
|
|
30
|
-
function __() { this.constructor = d; }
|
|
31
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
32
|
-
};
|
|
33
|
-
})();
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.LogClient_Browser = void 0;
|
|
36
|
-
var types_1 = require("./types");
|
|
37
|
-
var LogClient_1 = require("./LogClient");
|
|
38
|
-
var __1 = require("../..");
|
|
39
|
-
var LogClient_Browser_class = /** @class */ (function (_super) {
|
|
40
|
-
__extends(LogClient_Browser_class, _super);
|
|
41
|
-
function LogClient_Browser_class() {
|
|
42
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
43
|
-
_this.style = {
|
|
44
|
-
base: {
|
|
45
|
-
// 'background-color': '#fff',
|
|
46
|
-
'padding': '2px 0px',
|
|
47
|
-
'border-radius': '2px',
|
|
48
|
-
},
|
|
49
|
-
verbose: {
|
|
50
|
-
'color': '#808080',
|
|
51
|
-
'background-color': 'unset'
|
|
52
|
-
},
|
|
53
|
-
debug: {
|
|
54
|
-
'color': '#6564c9',
|
|
55
|
-
},
|
|
56
|
-
info: {
|
|
57
|
-
'color': '#189702',
|
|
58
|
-
},
|
|
59
|
-
warning: {
|
|
60
|
-
'color': '#926E00',
|
|
61
|
-
},
|
|
62
|
-
error: {
|
|
63
|
-
'color': '#B40000',
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
return _this;
|
|
67
|
-
}
|
|
68
|
-
LogClient_Browser_class.prototype.getColor = function (level, bold) {
|
|
69
|
-
switch (level) {
|
|
70
|
-
case types_1.LogLevel.Verbose:
|
|
71
|
-
return (0, __1.getLogStyle)(this.style.base, this.style.verbose);
|
|
72
|
-
case types_1.LogLevel.Debug:
|
|
73
|
-
return (0, __1.getLogStyle)(this.style.base, this.style.debug);
|
|
74
|
-
case types_1.LogLevel.Info:
|
|
75
|
-
return (0, __1.getLogStyle)(this.style.base, this.style.info);
|
|
76
|
-
case types_1.LogLevel.Warning:
|
|
77
|
-
return (0, __1.getLogStyle)(this.style.base, this.style.warning);
|
|
78
|
-
case types_1.LogLevel.Error:
|
|
79
|
-
return (0, __1.getLogStyle)(this.style.base, this.style.error);
|
|
80
|
-
default:
|
|
81
|
-
return (0, __1.getLogStyle)({ 'color': '#000000' });
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
LogClient_Browser_class.prototype.logMessage = function (level, bold, prefix, toLog) {
|
|
85
|
-
for (var _i = 0, toLog_1 = toLog; _i < toLog_1.length; _i++) {
|
|
86
|
-
var param = toLog_1[_i];
|
|
87
|
-
if (typeof param === 'string') {
|
|
88
|
-
console.log("%c".concat(prefix).concat(param), this.getColor(level, bold));
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
if (typeof param === 'object') {
|
|
92
|
-
console.log("%c".concat(prefix), this.getColor(level, bold), param);
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
console.log("%c".concat(prefix), this.getColor(level, bold), param);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
return LogClient_Browser_class;
|
|
99
|
-
}(LogClient_1.LogClient));
|
|
100
|
-
exports.LogClient_Browser = new LogClient_Browser_class();
|
|
101
|
-
//# sourceMappingURL=LogClient_Browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogClient_Browser.js","sourceRoot":"","sources":["../../../src/main/core/logger/LogClient_Browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;;;AAEH,iCAA2C;AAC3C,yCAAsC;AACtC,2BAAsD;AAGtD;IACS,2CAAS;IADlB;QAAA,qEAyDC;QA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SAAS,EAAC,CAAC,CAAC;SAC1C;IACF,CAAC;IAES,4CAAU,GAApB,UAAqB,KAAe,EAAE,IAAa,EAAE,MAAc,EAAE,KAAiB;QACrF,KAAoB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;YAAtB,IAAM,KAAK,cAAA;YACf,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC9B,OAAO,CAAC,GAAG,CAAC,YAAK,MAAM,SAAG,KAAK,CAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;gBAC/D,SAAS;aACT;YACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC9B,OAAO,CAAC,GAAG,CAAC,YAAK,MAAM,CAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC9D,SAAS;aACT;YACD,OAAO,CAAC,GAAG,CAAC,YAAK,MAAM,CAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;SAC9D;IACF,CAAC;IACF,8BAAC;AAAD,CAAC,AAzDD,CACS,qBAAS,GAwDjB;AAEY,QAAA,iBAAiB,GAAG,IAAI,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LogLevel, LogParam } from "./types";
|
|
2
|
-
import { LogClient } from "./LogClient";
|
|
3
|
-
declare class LogClient_Function_class extends LogClient {
|
|
4
|
-
constructor();
|
|
5
|
-
protected logMessage(level: LogLevel, bold: boolean, prefix: string, toLog: LogParam[]): void;
|
|
6
|
-
}
|
|
7
|
-
export declare const LogClient_Function: LogClient_Function_class;
|
|
8
|
-
export {};
|