@nu-art/ts-common 0.100.11 → 0.100.14
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/debug-flags.d.ts +6 -2
- package/core/debug-flags.js +16 -6
- package/core/debug-flags.js.map +1 -1
- package/core/dispatcher.d.ts +2 -1
- package/core/dispatcher.js +8 -5
- package/core/dispatcher.js.map +1 -1
- package/core/logger/LogClient_Browser.d.ts +3 -2
- package/core/logger/LogClient_Browser.js +39 -16
- package/core/logger/LogClient_Browser.js.map +1 -1
- package/core/logger/Logger.d.ts +2 -3
- package/core/logger/Logger.js +4 -5
- package/core/logger/Logger.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/tools/get-log-style.d.ts +14 -0
- package/tools/get-log-style.js +43 -0
- package/tools/get-log-style.js.map +1 -0
package/core/debug-flags.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { LogLevel } from './logger/types';
|
|
1
2
|
export declare class DebugFlag {
|
|
2
3
|
private readonly key;
|
|
4
|
+
private minLogLevel;
|
|
3
5
|
private constructor();
|
|
6
|
+
setMinLevel(minLogLevel: LogLevel): void;
|
|
4
7
|
rename(newKey: string): void;
|
|
5
8
|
getKey(): string;
|
|
6
9
|
enable(enable?: boolean): void;
|
|
10
|
+
isEnabled(): boolean;
|
|
11
|
+
canLog(level: LogLevel): boolean;
|
|
7
12
|
private _enable;
|
|
8
13
|
private _disable;
|
|
9
|
-
isEnabled(): boolean;
|
|
10
14
|
}
|
|
11
15
|
export declare class DebugFlags {
|
|
12
16
|
static readonly instance: DebugFlags;
|
|
@@ -15,7 +19,7 @@ export declare class DebugFlags {
|
|
|
15
19
|
};
|
|
16
20
|
readonly ActiveDebugFlags: string[];
|
|
17
21
|
private constructor();
|
|
18
|
-
static createFlag(key: string): any;
|
|
22
|
+
static createFlag(key: string, minLogLevel?: LogLevel): any;
|
|
19
23
|
static add(flag: DebugFlag): void;
|
|
20
24
|
static rename(previousKey: string, newKey: string): void;
|
|
21
25
|
}
|
package/core/debug-flags.js
CHANGED
|
@@ -19,11 +19,17 @@
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.DebugFlags = exports.DebugFlag = void 0;
|
|
21
21
|
var array_tools_1 = require("../utils/array-tools");
|
|
22
|
+
var types_1 = require("./logger/types");
|
|
22
23
|
var DebugFlag = /** @class */ (function () {
|
|
23
|
-
function DebugFlag(key) {
|
|
24
|
+
function DebugFlag(key, minLogLevel) {
|
|
25
|
+
if (minLogLevel === void 0) { minLogLevel = types_1.LogLevel.Info; }
|
|
24
26
|
this.key = key;
|
|
27
|
+
this.minLogLevel = minLogLevel;
|
|
25
28
|
DebugFlags.add(this);
|
|
26
29
|
}
|
|
30
|
+
DebugFlag.prototype.setMinLevel = function (minLogLevel) {
|
|
31
|
+
this.minLogLevel = minLogLevel;
|
|
32
|
+
};
|
|
27
33
|
DebugFlag.prototype.rename = function (newKey) {
|
|
28
34
|
DebugFlags.rename(this.key, newKey);
|
|
29
35
|
};
|
|
@@ -39,15 +45,18 @@ var DebugFlag = /** @class */ (function () {
|
|
|
39
45
|
else
|
|
40
46
|
this._disable();
|
|
41
47
|
};
|
|
48
|
+
DebugFlag.prototype.isEnabled = function () {
|
|
49
|
+
return DebugFlags.instance.ActiveDebugFlags.includes(this.key);
|
|
50
|
+
};
|
|
51
|
+
DebugFlag.prototype.canLog = function (level) {
|
|
52
|
+
return types_1.LogLevelOrdinal.indexOf(level) >= types_1.LogLevelOrdinal.indexOf(this.minLogLevel);
|
|
53
|
+
};
|
|
42
54
|
DebugFlag.prototype._enable = function () {
|
|
43
55
|
(0, array_tools_1.addItemToArray)(DebugFlags.instance.ActiveDebugFlags, this.key);
|
|
44
56
|
};
|
|
45
57
|
DebugFlag.prototype._disable = function () {
|
|
46
58
|
(0, array_tools_1.removeItemFromArray)(DebugFlags.instance.ActiveDebugFlags, this.key);
|
|
47
59
|
};
|
|
48
|
-
DebugFlag.prototype.isEnabled = function () {
|
|
49
|
-
return DebugFlags.instance.ActiveDebugFlags.includes(this.key);
|
|
50
|
-
};
|
|
51
60
|
return DebugFlag;
|
|
52
61
|
}());
|
|
53
62
|
exports.DebugFlag = DebugFlag;
|
|
@@ -56,9 +65,10 @@ var DebugFlags = /** @class */ (function () {
|
|
|
56
65
|
this.AllDebugFlags = {};
|
|
57
66
|
this.ActiveDebugFlags = [];
|
|
58
67
|
}
|
|
59
|
-
DebugFlags.createFlag = function (key) {
|
|
68
|
+
DebugFlags.createFlag = function (key, minLogLevel) {
|
|
69
|
+
if (minLogLevel === void 0) { minLogLevel = types_1.LogLevel.Info; }
|
|
60
70
|
// @ts-ignore
|
|
61
|
-
return new DebugFlag(key);
|
|
71
|
+
return new DebugFlag(key, minLogLevel);
|
|
62
72
|
};
|
|
63
73
|
DebugFlags.add = function (flag) {
|
|
64
74
|
this.instance.AllDebugFlags[flag.getKey()] = flag;
|
package/core/debug-flags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-flags.js","sourceRoot":"","sources":["../../src/main/core/debug-flags.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;
|
|
1
|
+
{"version":3,"file":"debug-flags.js","sourceRoot":"","sources":["../../src/main/core/debug-flags.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,oDAAyE;AACzE,wCAAyD;AAGzD;IAKC,mBAAoB,GAAW,EAAE,WAAqC;QAArC,4BAAA,EAAA,cAAwB,gBAAQ,CAAC,IAAI;QACrE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,+BAAW,GAAX,UAAY,WAAqB;QAChC,IAAI,CAAC,WAAW,GAAG,WAA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GAAG,EAAE,WAAW,CAAC,CAAC;IACxC,CAAC;IAEM,cAAG,GAAV,UAAW,IAAe;QACzB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACnD,CAAC;IAEM,iBAAM,GAAb,UAAc,WAAmB,EAAE,MAAc;QAChD,IAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI;YACR,OAAO;QAER,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC5C,CAAC;IAxBe,mBAAQ,GAAe,IAAI,UAAU,EAAE,CAAC;IAyBzD,iBAAC;CAAA,AA3BD,IA2BC;AA3BY,gCAAU"}
|
package/core/dispatcher.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FunctionKeys, ReturnPromiseType } from '../utils/types';
|
|
2
|
+
import { Logger } from './logger/Logger';
|
|
2
3
|
export declare type ParamResolver<T, K extends keyof T> = T[K] extends (...args: any) => any ? Parameters<T[K]> : never;
|
|
3
4
|
export declare type ReturnTypeResolver<T, K extends keyof T> = T[K] extends (...args: any) => any ? ReturnPromiseType<T[K]> : never;
|
|
4
|
-
export declare class Processor<T, K extends FunctionKeys<T>> {
|
|
5
|
+
export declare class Processor<T, K extends FunctionKeys<T>> extends Logger {
|
|
5
6
|
static modulesResolver: () => any[];
|
|
6
7
|
readonly method: K;
|
|
7
8
|
protected readonly filter: (listener: any) => boolean;
|
package/core/dispatcher.js
CHANGED
|
@@ -69,11 +69,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
};
|
|
70
70
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
71
|
exports.Dispatcher = exports.Processor = void 0;
|
|
72
|
-
var
|
|
72
|
+
var Logger_1 = require("./logger/Logger");
|
|
73
|
+
var Processor = /** @class */ (function (_super) {
|
|
74
|
+
__extends(Processor, _super);
|
|
73
75
|
function Processor(method) {
|
|
74
|
-
var _this = this;
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
var _this = _super.call(this, method) || this;
|
|
77
|
+
_this.method = method;
|
|
78
|
+
_this.filter = function (listener) { return !!listener[_this.method]; };
|
|
79
|
+
return _this;
|
|
77
80
|
}
|
|
78
81
|
Processor.prototype.processModules = function (processor) {
|
|
79
82
|
return this.filterModules().filter(this.filter).map(processor);
|
|
@@ -90,7 +93,7 @@ var Processor = /** @class */ (function () {
|
|
|
90
93
|
return listeners.filter(this.filter);
|
|
91
94
|
};
|
|
92
95
|
return Processor;
|
|
93
|
-
}());
|
|
96
|
+
}(Logger_1.Logger));
|
|
94
97
|
exports.Processor = Processor;
|
|
95
98
|
var Dispatcher = /** @class */ (function (_super) {
|
|
96
99
|
__extends(Dispatcher, _super);
|
package/core/dispatcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/main/core/dispatcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/main/core/dispatcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,0CAAuC;AAMvC;IACS,6BAAM;IAOd,mBAAY,MAAS;QAArB,YACC,kBAAM,MAAgB,CAAC,SAGvB;QAFA,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,MAAM,GAAG,UAAC,QAAa,IAAK,OAAA,CAAC,CAAC,QA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;AAAD,CAAC,AAvBD,CAIS,SAAS,GAmBjB;AAvBY,gCAAU"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { LogLevel, LogParam } from
|
|
2
|
-
import { LogClient } from
|
|
1
|
+
import { LogLevel, LogParam } from './types';
|
|
2
|
+
import { LogClient } from './LogClient';
|
|
3
3
|
declare class LogClient_Browser_class extends LogClient {
|
|
4
|
+
private style;
|
|
4
5
|
getColor(level: LogLevel, bold: boolean): string;
|
|
5
6
|
protected logMessage(level: LogLevel, bold: boolean, prefix: string, toLog: LogParam[]): void;
|
|
6
7
|
}
|
|
@@ -35,38 +35,61 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
35
|
exports.LogClient_Browser = void 0;
|
|
36
36
|
var types_1 = require("./types");
|
|
37
37
|
var LogClient_1 = require("./LogClient");
|
|
38
|
+
var __1 = require("../..");
|
|
38
39
|
var LogClient_Browser_class = /** @class */ (function (_super) {
|
|
39
40
|
__extends(LogClient_Browser_class, _super);
|
|
40
41
|
function LogClient_Browser_class() {
|
|
41
|
-
|
|
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
|
+
'background-color': '#6564c9',
|
|
55
|
+
},
|
|
56
|
+
info: {
|
|
57
|
+
'background-color': '#189702',
|
|
58
|
+
},
|
|
59
|
+
warning: {
|
|
60
|
+
'background-color': '#926E00',
|
|
61
|
+
},
|
|
62
|
+
error: {
|
|
63
|
+
'background-color': '#B40000',
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return _this;
|
|
42
67
|
}
|
|
43
68
|
LogClient_Browser_class.prototype.getColor = function (level, bold) {
|
|
44
|
-
var color;
|
|
45
69
|
switch (level) {
|
|
46
70
|
case types_1.LogLevel.Verbose:
|
|
47
|
-
|
|
48
|
-
break;
|
|
71
|
+
return (0, __1.getLogStyle)(this.style.base, this.style.verbose);
|
|
49
72
|
case types_1.LogLevel.Debug:
|
|
50
|
-
|
|
51
|
-
break;
|
|
73
|
+
return (0, __1.getLogStyle)(this.style.base, this.style.debug);
|
|
52
74
|
case types_1.LogLevel.Info:
|
|
53
|
-
|
|
54
|
-
break;
|
|
75
|
+
return (0, __1.getLogStyle)(this.style.base, this.style.info);
|
|
55
76
|
case types_1.LogLevel.Warning:
|
|
56
|
-
|
|
57
|
-
break;
|
|
77
|
+
return (0, __1.getLogStyle)(this.style.base, this.style.warning);
|
|
58
78
|
case types_1.LogLevel.Error:
|
|
59
|
-
|
|
60
|
-
|
|
79
|
+
return (0, __1.getLogStyle)(this.style.base, this.style.error);
|
|
80
|
+
default:
|
|
81
|
+
return (0, __1.getLogStyle)({ 'color': '#000000' });
|
|
61
82
|
}
|
|
62
|
-
return color || '#000000';
|
|
63
83
|
};
|
|
64
84
|
LogClient_Browser_class.prototype.logMessage = function (level, bold, prefix, toLog) {
|
|
65
|
-
var color = this.getColor(level, bold);
|
|
66
85
|
for (var _i = 0, toLog_1 = toLog; _i < toLog_1.length; _i++) {
|
|
67
86
|
var param = toLog_1[_i];
|
|
68
|
-
if (typeof param ===
|
|
69
|
-
console.log("%c".concat(prefix).concat(param),
|
|
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);
|
|
70
93
|
continue;
|
|
71
94
|
}
|
|
72
95
|
console.log(param);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogClient_Browser.js","sourceRoot":"","sources":["../../../src/main/core/logger/LogClient_Browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;;;AAEH,
|
|
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;QAtDQ,WAAK,GAAuB;YACnC,IAAI,EAAE;gBACL,kBAAkB,EAAE,MAAM;gBAC1B,SAAS,EAAE,SAAS;gBACpB,eAAe,EAAE,KAAK;aACtB;YACD,OAAO,EAAE;gBACR,OAAO,EAAE,SAAS;gBAClB,kBAAkB,EAAE,OAAO;aAC3B;YACD,KAAK,EAAE;gBACN,kBAAkB,EAAE,SAAS;aAC7B;YACD,IAAI,EAAE;gBACL,kBAAkB,EAAE,SAAS;aAC7B;YACD,OAAO,EAAE;gBACR,kBAAkB,EAAE,SAAS;aAC7B;YACD,KAAK,EAAE;gBACN,kBAAkB,EAAE,SAAS;aAC7B;SACD,CAAC;;IAgCH,CAAC;IA9BA,0CAAQ,GAAR,UAAS,KAAe,EAAE,IAAa;QACtC,QAAQ,KAAK,EAAE;YACd,KAAK,gBAAQ,CAAC,OAAO;gBACpB,OAAO,IAAA,eAAW,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACzD,KAAK,gBAAQ,CAAC,KAAK;gBAClB,OAAO,IAAA,eAAW,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACvD,KAAK,gBAAQ,CAAC,IAAI;gBACjB,OAAO,IAAA,eAAW,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAA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lag } from '../debug-flags';
|
|
2
|
+
import { LogLevel, LogParam } from './types';
|
|
3
3
|
export declare class Logger {
|
|
4
4
|
static readonly log: Logger;
|
|
5
5
|
private tag;
|
|
6
6
|
static defaultFlagState: boolean;
|
|
7
7
|
protected readonly _DEBUG_FLAG: DebugFlag;
|
|
8
|
-
protected minLevel: LogLevel;
|
|
9
8
|
constructor(tag?: string);
|
|
10
9
|
setMinLevel(minLevel: LogLevel): void;
|
|
11
10
|
protected setTag(tag: string): void;
|
package/core/logger/Logger.js
CHANGED
|
@@ -23,13 +23,12 @@ var types_1 = require("./types");
|
|
|
23
23
|
var BeLogged_1 = require("./BeLogged");
|
|
24
24
|
var Logger = /** @class */ (function () {
|
|
25
25
|
function Logger(tag) {
|
|
26
|
-
this.
|
|
27
|
-
this.tag = tag !== null && tag !== void 0 ? tag : this.constructor["name"];
|
|
26
|
+
this.tag = tag !== null && tag !== void 0 ? tag : this.constructor['name'];
|
|
28
27
|
this._DEBUG_FLAG = debug_flags_1.DebugFlags.createFlag(this.tag);
|
|
29
28
|
this._DEBUG_FLAG.enable(Logger.defaultFlagState);
|
|
30
29
|
}
|
|
31
30
|
Logger.prototype.setMinLevel = function (minLevel) {
|
|
32
|
-
this.minLevel
|
|
31
|
+
this._DEBUG_FLAG.setMinLevel(minLevel);
|
|
33
32
|
};
|
|
34
33
|
Logger.prototype.setTag = function (tag) {
|
|
35
34
|
this.tag = tag;
|
|
@@ -114,9 +113,9 @@ var Logger = /** @class */ (function () {
|
|
|
114
113
|
Logger.prototype.assertCanPrint = function (level) {
|
|
115
114
|
if (!this._DEBUG_FLAG.isEnabled())
|
|
116
115
|
return;
|
|
117
|
-
return
|
|
116
|
+
return this._DEBUG_FLAG.canLog(level);
|
|
118
117
|
};
|
|
119
|
-
Logger.log = new Logger(
|
|
118
|
+
Logger.log = new Logger('LOGGER');
|
|
120
119
|
Logger.defaultFlagState = true;
|
|
121
120
|
return Logger;
|
|
122
121
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/main/core/logger/Logger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,
|
|
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;IAQC,gBAAmB,GAAY;QAC9B,IAAI,CAAC,GAAG,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAE3C,IAAI,CAAC,WAAW,GAAG,wBAAU,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAClD,CAAC;IAED,4BAAW,GAAX,UAAY,QAAkB;QAC7B,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,uBAAM,GAAhB,UAAiB,GAAW;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,2BAAU,GAAjB;QAAkB,eAAoB;aAApB,UAAoB,EAApB,qBAAoB,EAApB,IAAoB;YAApB,0BAAoB;;QACrC,IAAI,CAAC,GAAG,CAAC,gBAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAEM,yBAAQ,GAAf;QAAgB,eAAoB;aAApB,UAAoB,EAApB,qBAAoB,EAApB,IAAoB;YAApB,0BAAoB;;QACnC,IAAI,CAAC,GAAG,CAAC,gBAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACxC,CAA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ACzC,IAAI,CAAC,GAAG,CAAC,gBAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAEM,6BAAY,GAAnB;QAAoB,eAAoB;aAApB,UAAoB,EAApB,qBAAoB,EAApB,IAAoB;YAApB,0BAAoB;;QACvC,IAAI,CAAC,GAAG,CAAC,gBAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAEM,oBAAG,GAAV,UAAW,KAAe,EAAE,IAAa,EAAE,KAAiB;QAC3D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;YAC9B,OAAO;QAER,aAAa;QACb,mBAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAEO,+BAAc,GAAtB,UAAuB,KAAe;QACrC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE;YAChC,OAAO;QAER,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IA3EsB,UAAG,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;IAGpC,uBAAgB,GAAG,IAAI,CAAC;IAyEvC,aAAC;CAAA,AA9ED,IA8EC;AA9EY,wBAAM"}
|
package/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './core/logger/types';
|
|
|
18
18
|
export * from './core/logger/LogClient';
|
|
19
19
|
export * from './permissions/permission-group';
|
|
20
20
|
export * from './tools/Replacer';
|
|
21
|
+
export * from './tools/get-log-style';
|
|
21
22
|
export * from './utils/queue';
|
|
22
23
|
export * from './utils/types';
|
|
23
24
|
export * from './utils/crypto-tools';
|
package/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __exportStar(require("./core/logger/types"), exports);
|
|
|
51
51
|
__exportStar(require("./core/logger/LogClient"), exports);
|
|
52
52
|
__exportStar(require("./permissions/permission-group"), exports);
|
|
53
53
|
__exportStar(require("./tools/Replacer"), exports);
|
|
54
|
+
__exportStar(require("./tools/get-log-style"), exports);
|
|
54
55
|
__exportStar(require("./utils/queue"), exports);
|
|
55
56
|
__exportStar(require("./utils/types"), exports);
|
|
56
57
|
__exportStar(require("./utils/crypto-tools"), exports);
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;AAEH,uDAAqC;AAErC,gDAA8B;AAC9B,wDAAsC;AACtC,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AAEtC,qDAAmC;AACnC,sDAAoC;AACpC,qEAAmD;AACnD,mEAAiD;AACjD,oEAAkD;AAClD,kEAAgD;AAChD,mEAAiD;AACjD,yDAAuC;AACvC,uDAAqC;AACrC,sDAAoC;AACpC,0DAAwC;AAExC,iEAA+C;AAE/C,mDAAiC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;AAEH,uDAAqC;AAErC,gDAA8B;AAC9B,wDAAsC;AACtC,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AAEtC,qDAAmC;AACnC,sDAAoC;AACpC,qEAAmD;AACnD,mEAAiD;AACjD,oEAAkD;AAClD,kEAAgD;AAChD,mEAAiD;AACjD,yDAAuC;AACvC,uDAAqC;AACrC,sDAAoC;AACpC,0DAAwC;AAExC,iEAA+C;AAE/C,mDAAiC;AACjC,wDAAsC;AAEtC,gDAA8B;AAC9B,gDAA8B;AAC9B,uDAAqC;AACrC,uDAAqC;AACrC,iEAA+C;AAC/C,yDAAuC;AACvC,uDAAqC;AACrC,uDAAqC;AACrC,0DAAwC;AACxC,sDAAoC;AACpC,uDAAqC;AACrC,sDAAoC;AACpC,wDAAsC;AACtC,gDAA8B;AAC9B,qDAAmC;AACnC,uDAAqC;AAErC,wDAAsC;AAEtC,kDAAgC;AAEhC,4DAA0C;AAC1C,2DAAyC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare type LogStyle = {
|
|
2
|
+
'color'?: string;
|
|
3
|
+
'background-color'?: string;
|
|
4
|
+
'padding'?: string;
|
|
5
|
+
'border-radius'?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Returns a style string for console.log()
|
|
9
|
+
* To log with style, make sure to add '%c' at the start of the log.
|
|
10
|
+
* log structure should be: console.log('%cTEXT HERE', STYLE STRING, any other items to log)
|
|
11
|
+
*
|
|
12
|
+
* @param styleObj - one or more style objects defining the log style
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLogStyle(...styleObj: LogStyle[]): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
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.getLogStyle = void 0;
|
|
21
|
+
var object_tools_1 = require("../utils/object-tools");
|
|
22
|
+
/**
|
|
23
|
+
* Returns a style string for console.log()
|
|
24
|
+
* To log with style, make sure to add '%c' at the start of the log.
|
|
25
|
+
* log structure should be: console.log('%cTEXT HERE', STYLE STRING, any other items to log)
|
|
26
|
+
*
|
|
27
|
+
* @param styleObj - one or more style objects defining the log style
|
|
28
|
+
*/
|
|
29
|
+
function getLogStyle() {
|
|
30
|
+
var styleObj = [];
|
|
31
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
32
|
+
styleObj[_i] = arguments[_i];
|
|
33
|
+
}
|
|
34
|
+
var style = '';
|
|
35
|
+
styleObj.forEach(function (obj) {
|
|
36
|
+
var _arr = (0, object_tools_1._keys)(obj).map(function (key) { return "".concat(key, ": ").concat(obj[key]); });
|
|
37
|
+
style += _arr.join(';');
|
|
38
|
+
style += ';';
|
|
39
|
+
});
|
|
40
|
+
return style;
|
|
41
|
+
}
|
|
42
|
+
exports.getLogStyle = getLogStyle;
|
|
43
|
+
//# sourceMappingURL=get-log-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-log-style.js","sourceRoot":"","sources":["../../src/main/tools/get-log-style.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,sDAA4C;AAS5C;;;;;;GAMG;AACH,SAAgB,WAAW;IAAC,kBAAuB;SAAvB,UAAuB,EAAvB,qBAAuB,EAAvB,IAAuB;QAAvB,6BAAuB;;IAClD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,QAAQ,CAAC,OAAO,CAAC,UAAA,GAAG;QACnB,IAAM,IAAI,GAAG,IAAA,oBAAK,EAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,UAAG,GAAG,eAAK,GAAG,CAAC,GAAG,CAAC,CAAE,EAArB,CAAqB,CAAC,CAAC;QAC1D,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,KAAK,IAAI,GAAG,CAAC;IACd,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACd,CAAC;AARD,kCAQC"}
|