@rockster/logger 0.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/env.d.ts +23 -0
- package/env.js +61 -0
- package/env.js.map +1 -0
- package/functions/emit-log.d.ts +2 -0
- package/functions/emit-log.js +8 -0
- package/functions/emit-log.js.map +1 -0
- package/functions/enable-console.d.ts +4 -0
- package/functions/enable-console.js +19 -0
- package/functions/enable-console.js.map +1 -0
- package/functions/get-error-infos.d.ts +4 -0
- package/functions/get-error-infos.js +43 -0
- package/functions/get-error-infos.js.map +1 -0
- package/functions/index.d.ts +5 -0
- package/functions/index.js +22 -0
- package/functions/index.js.map +1 -0
- package/functions/is-development.d.ts +1 -0
- package/functions/is-development.js +9 -0
- package/functions/is-development.js.map +1 -0
- package/functions/uncaught-exception.d.ts +1 -0
- package/functions/uncaught-exception.js +8 -0
- package/functions/uncaught-exception.js.map +1 -0
- package/functions/unhandled-rejection.d.ts +1 -0
- package/functions/unhandled-rejection.js +8 -0
- package/functions/unhandled-rejection.js.map +1 -0
- package/index.d.ts +8 -0
- package/index.js +25 -0
- package/index.js.map +1 -0
- package/interfaces/enums/index.d.ts +1 -0
- package/interfaces/enums/index.js +18 -0
- package/interfaces/enums/index.js.map +1 -0
- package/interfaces/enums/log-type.d.ts +6 -0
- package/interfaces/enums/log-type.js +11 -0
- package/interfaces/enums/log-type.js.map +1 -0
- package/interfaces/history.d.ts +5 -0
- package/interfaces/history.js +3 -0
- package/interfaces/history.js.map +1 -0
- package/interfaces/index.d.ts +5 -0
- package/interfaces/index.js +22 -0
- package/interfaces/index.js.map +1 -0
- package/interfaces/log-callback.d.ts +4 -0
- package/interfaces/log-callback.js +3 -0
- package/interfaces/log-callback.js.map +1 -0
- package/interfaces/log-stdout-callback.d.ts +3 -0
- package/interfaces/log-stdout-callback.js +3 -0
- package/interfaces/log-stdout-callback.js.map +1 -0
- package/interfaces/log.d.ts +31 -0
- package/interfaces/log.js +17 -0
- package/interfaces/log.js.map +1 -0
- package/logger-subscribe.d.ts +2 -0
- package/logger-subscribe.js +13 -0
- package/logger-subscribe.js.map +1 -0
- package/logger.d.ts +21 -0
- package/logger.js +94 -0
- package/logger.js.map +1 -0
- package/package.json +35 -0
- package/stdout-subscribe.d.ts +2 -0
- package/stdout-subscribe.js +13 -0
- package/stdout-subscribe.js.map +1 -0
- package/stdout-writer.d.ts +29 -0
- package/stdout-writer.js +148 -0
- package/stdout-writer.js.map +1 -0
package/env.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import '@rockster/common/utils';
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import 'colors';
|
|
4
|
+
import { EventEmitter } from "events";
|
|
5
|
+
import { IHistory, LogCallback, LogStdoutCallback } from "./interfaces";
|
|
6
|
+
import { StdoutWriter } from './stdout-writer';
|
|
7
|
+
import { Dictionary } from '@rockster/common';
|
|
8
|
+
export declare const logEvent = "onLog";
|
|
9
|
+
export declare const stdoutEvent = "onStdout";
|
|
10
|
+
declare global {
|
|
11
|
+
var logger: {
|
|
12
|
+
name: string;
|
|
13
|
+
emitter: EventEmitter;
|
|
14
|
+
history: IHistory;
|
|
15
|
+
dataFormat: string;
|
|
16
|
+
stdout: {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
writer: StdoutWriter;
|
|
19
|
+
emitter: EventEmitter;
|
|
20
|
+
};
|
|
21
|
+
subscriptions: Dictionary<LogStdoutCallback | LogCallback>;
|
|
22
|
+
};
|
|
23
|
+
}
|
package/env.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.stdoutEvent = exports.logEvent = void 0;
|
|
7
|
+
require("@rockster/common/utils");
|
|
8
|
+
require("reflect-metadata");
|
|
9
|
+
require("colors");
|
|
10
|
+
const events_1 = require("events");
|
|
11
|
+
const interfaces_1 = require("./interfaces");
|
|
12
|
+
const intercept_stdout_1 = __importDefault(require("intercept-stdout"));
|
|
13
|
+
const functions_1 = require("./functions");
|
|
14
|
+
const stdout_writer_1 = require("./stdout-writer");
|
|
15
|
+
exports.logEvent = 'onLog';
|
|
16
|
+
exports.stdoutEvent = 'onStdout';
|
|
17
|
+
global.logger = {
|
|
18
|
+
name: 'App',
|
|
19
|
+
emitter: new events_1.EventEmitter(),
|
|
20
|
+
dataFormat: 'MM/DD/YYYY, hh:mm:ss A',
|
|
21
|
+
subscriptions: {},
|
|
22
|
+
history: {
|
|
23
|
+
logs: [],
|
|
24
|
+
stdout: []
|
|
25
|
+
},
|
|
26
|
+
stdout: {
|
|
27
|
+
writer: new stdout_writer_1.StdoutWriter(),
|
|
28
|
+
emitter: new events_1.EventEmitter(),
|
|
29
|
+
enabled: false
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
(0, intercept_stdout_1.default)((value) => {
|
|
33
|
+
logger.history.stdout.push(value);
|
|
34
|
+
logger.emitter.emit(exports.stdoutEvent, value);
|
|
35
|
+
});
|
|
36
|
+
logger.emitter.on(exports.logEvent, (log) => {
|
|
37
|
+
logger.history.logs.push(log);
|
|
38
|
+
});
|
|
39
|
+
(0, functions_1.uncaughtException)((error) => {
|
|
40
|
+
const isLogError = error.type === interfaces_1.LogType.error;
|
|
41
|
+
const logError = !isLogError
|
|
42
|
+
? new interfaces_1.LogError(error.message, getNow(), 'UncaughtException')
|
|
43
|
+
: error;
|
|
44
|
+
logError.stack = error.stack;
|
|
45
|
+
logger.emitter.emit(exports.logEvent, logError);
|
|
46
|
+
if (!logger.stdout.enabled) {
|
|
47
|
+
logger.stdout.writer.write(logError);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
(0, functions_1.unhandledRejection)((error) => {
|
|
51
|
+
const isLogError = error.type === interfaces_1.LogType.error;
|
|
52
|
+
const logError = !isLogError
|
|
53
|
+
? new interfaces_1.LogError(error.message, getNow(), 'UnhandledRejection')
|
|
54
|
+
: error;
|
|
55
|
+
logError.stack = error.stack;
|
|
56
|
+
logger.emitter.emit(exports.logEvent, logError);
|
|
57
|
+
if (!logger.stdout.enabled) {
|
|
58
|
+
logger.stdout.writer.write(logError);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=env.js.map
|
package/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../env.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAgC;AAChC,4BAA0B;AAC1B,kBAAgB;AAChB,mCAAsC;AACtC,6CAMsB;AACtB,wEAAyC;AACzC,2CAGqB;AACrB,mDAA+C;AAElC,QAAA,QAAQ,GAAG,OAAO,CAAC;AACnB,QAAA,WAAW,GAAG,UAAU,CAAC;AAyCtC,MAAM,CAAC,MAAM,GAAG;IACb,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,IAAI,qBAAY,EAAE;IAC3B,UAAU,EAAE,wBAAwB;IACpC,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE;QACN,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;KACZ;IACD,MAAM,EAAE;QACL,MAAM,EAAE,IAAI,4BAAY,EAAE;QAC1B,OAAO,EAAE,IAAI,qBAAY,EAAE;QAC3B,OAAO,EAAE,KAAK;KAChB;CACH,CAAC;AAEF,IAAA,0BAAS,EAAC,CAAC,KAAK,EAAE,EAAE;IACjB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAW,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,gBAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;IACj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,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-log.js","sourceRoot":"","sources":["../../functions/emit-log.ts"],"names":[],"mappings":";;;AAEO,MAAM,OAAO,GAAG,CACpB,KAAa,EACb,GAAQ,EACT,EAAE;IACD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableConsole = void 0;
|
|
4
|
+
const env_1 = require("../env");
|
|
5
|
+
const enableConsole = ({ appName, dateFormat }) => {
|
|
6
|
+
if (logger.stdout.enabled) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (dateFormat) {
|
|
10
|
+
logger.dataFormat = dateFormat;
|
|
11
|
+
}
|
|
12
|
+
logger.name = appName;
|
|
13
|
+
logger.stdout.enabled = true;
|
|
14
|
+
logger.emitter.on(env_1.logEvent, (log) => {
|
|
15
|
+
logger.stdout.writer.write(log);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.enableConsole = enableConsole;
|
|
19
|
+
//# sourceMappingURL=enable-console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable-console.js","sourceRoot":"","sources":["../../functions/enable-console.ts"],"names":[],"mappings":";;;AAAA,gCAAkC;AAE3B,MAAM,aAAa,GAAG,CAAC,EAC3B,OAAO,EACP,UAAU,EAIZ,EAAE,EAAE;IAEF,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO;IACV,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACd,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,MAAM,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,cAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QACjC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACN,CAAC,CAAA;AArBY,QAAA,aAAa,iBAqBzB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getErrorInfos = void 0;
|
|
4
|
+
const getErrorInfos = (error, message = '', parent = '', values = {}) => {
|
|
5
|
+
const descriptors = Object.getOwnPropertyDescriptors(error);
|
|
6
|
+
Object.getOwnPropertyNames(descriptors).forEach((property) => {
|
|
7
|
+
values[property] = descriptors[property].value;
|
|
8
|
+
});
|
|
9
|
+
Object.getOwnPropertyNames(error).forEach((property) => {
|
|
10
|
+
values[property] = error[property];
|
|
11
|
+
});
|
|
12
|
+
Object.getOwnPropertyNames(values).forEach((property) => {
|
|
13
|
+
if (property === 'stack') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(values[property])) {
|
|
17
|
+
values[property].forEach((arrayItem, index) => {
|
|
18
|
+
if (typeof (arrayItem) === 'object') {
|
|
19
|
+
values[property][index] = {};
|
|
20
|
+
const errorInfos = (0, exports.getErrorInfos)(arrayItem, message, `${parent}${property}[${index}].`, values[property][index]);
|
|
21
|
+
message += errorInfos.message;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
message += `${arrayItem}\n`;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else if (typeof (values[property]) === 'object') {
|
|
29
|
+
values[property] = {};
|
|
30
|
+
const errorInfos = (0, exports.getErrorInfos)(values[property], message, `${parent}${property}.`, values[property]);
|
|
31
|
+
message += errorInfos.message;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
message += `${parent}${property}: ${values[property]}\n`;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
message,
|
|
39
|
+
values
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.getErrorInfos = getErrorInfos;
|
|
43
|
+
//# sourceMappingURL=get-error-infos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-error-infos.js","sourceRoot":"","sources":["../../functions/get-error-infos.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAC1B,KAAY,EACZ,UAAkB,EAAE,EACpB,SAAiB,EAAE,EACnB,SAAc,EAAE,EACjB,EAAE;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC1D,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACpD,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACrD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QACrC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACnC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;gBAC3C,IAAI,OAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;oBAClC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;oBAC7B,MAAM,UAAU,GAAG,IAAA,qBAAa,EAC7B,SAAS,EACT,OAAO,EACP,GAAG,MAAM,GAAG,QAAQ,IAAI,KAAK,IAAI,EACjC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CACzB,CAAC;oBACF,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC;gBACjC,CAAC;qBAAM,CAAC;oBACL,OAAO,IAAI,GAAG,SAAS,IAAI,CAAA;gBAC9B,CAAC;YACJ,CAAC,CAAC,CAAC;QACN,CAAC;aAAM,IAAI,OAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YAChD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;YACtB,MAAM,UAAU,GAAG,IAAA,qBAAa,EAC7B,MAAM,CAAC,QAAQ,CAAC,EAChB,OAAO,EACP,GAAG,MAAM,GAAG,QAAQ,GAAG,EACvB,MAAM,CAAC,QAAQ,CAAC,CAClB,CAAC;YACF,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC;QACjC,CAAC;aAAM,CAAC;YACL,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;QAC3D,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO;QACJ,OAAO;QACP,MAAM;KACR,CAAC;AACL,CAAC,CAAA;AA/CY,QAAA,aAAa,iBA+CzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enable-console"), exports);
|
|
18
|
+
__exportStar(require("./is-development"), exports);
|
|
19
|
+
__exportStar(require("./uncaught-exception"), exports);
|
|
20
|
+
__exportStar(require("./unhandled-rejection"), exports);
|
|
21
|
+
__exportStar(require("./get-error-infos"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC;AACjC,uDAAqC;AACrC,wDAAsC;AACtC,oDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isDevelopment: () => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDevelopment = void 0;
|
|
4
|
+
const isDevelopment = () => {
|
|
5
|
+
return process.env.NODE_ENV === 'dev'
|
|
6
|
+
|| process.env.NODE_ENV === 'development';
|
|
7
|
+
};
|
|
8
|
+
exports.isDevelopment = isDevelopment;
|
|
9
|
+
//# sourceMappingURL=is-development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-development.js","sourceRoot":"","sources":["../../functions/is-development.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,GAAG,EAAE;IAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,KAAK;WAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAC7C,CAAC,CAAA;AAHY,QAAA,aAAa,iBAGzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const uncaughtException: (callback: NodeJS.UncaughtExceptionListener) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uncaughtException = void 0;
|
|
4
|
+
const uncaughtException = (callback) => {
|
|
5
|
+
process.on('uncaughtException', callback);
|
|
6
|
+
};
|
|
7
|
+
exports.uncaughtException = uncaughtException;
|
|
8
|
+
//# sourceMappingURL=uncaught-exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uncaught-exception.js","sourceRoot":"","sources":["../../functions/uncaught-exception.ts"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,GAAG,CAC9B,QAA0C,EAC3C,EAAE;IACD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC,CAAA;AAJY,QAAA,iBAAiB,qBAI7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const unhandledRejection: (callback: NodeJS.UnhandledRejectionListener) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unhandledRejection = void 0;
|
|
4
|
+
const unhandledRejection = (callback) => {
|
|
5
|
+
process.on('unhandledRejection', callback);
|
|
6
|
+
};
|
|
7
|
+
exports.unhandledRejection = unhandledRejection;
|
|
8
|
+
//# sourceMappingURL=unhandled-rejection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unhandled-rejection.js","sourceRoot":"","sources":["../../functions/unhandled-rejection.ts"],"names":[],"mappings":";;;AAAO,MAAM,kBAAkB,GAAG,CAC/B,QAA2C,EAC5C,EAAE;IACD,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAA;AAJY,QAAA,kBAAkB,sBAI9B"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './logger';
|
|
2
|
+
export * from './functions/enable-console';
|
|
3
|
+
export * from './functions/is-development';
|
|
4
|
+
export * from './stdout-subscribe';
|
|
5
|
+
export * from './logger-subscribe';
|
|
6
|
+
export * from './interfaces/log';
|
|
7
|
+
export * from './functions/emit-log';
|
|
8
|
+
export * from './interfaces';
|
package/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./logger"), exports);
|
|
18
|
+
__exportStar(require("./functions/enable-console"), exports);
|
|
19
|
+
__exportStar(require("./functions/is-development"), exports);
|
|
20
|
+
__exportStar(require("./stdout-subscribe"), exports);
|
|
21
|
+
__exportStar(require("./logger-subscribe"), exports);
|
|
22
|
+
__exportStar(require("./interfaces/log"), exports);
|
|
23
|
+
__exportStar(require("./functions/emit-log"), exports);
|
|
24
|
+
__exportStar(require("./interfaces"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6DAA2C;AAC3C,6DAA2C;AAC3C,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC;AACjC,uDAAqC;AACrC,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './log-type';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./log-type"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../interfaces/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogType = void 0;
|
|
4
|
+
var LogType;
|
|
5
|
+
(function (LogType) {
|
|
6
|
+
LogType["info"] = "info";
|
|
7
|
+
LogType["warn"] = "warn";
|
|
8
|
+
LogType["error"] = "error";
|
|
9
|
+
LogType["debug"] = "debug";
|
|
10
|
+
})(LogType || (exports.LogType = LogType = {}));
|
|
11
|
+
//# sourceMappingURL=log-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-type.js","sourceRoot":"","sources":["../../../interfaces/enums/log-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAKX;AALD,WAAY,OAAO;IAChB,wBAAa,CAAA;IACb,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,0BAAe,CAAA;AAClB,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../interfaces/history.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
|
18
|
+
__exportStar(require("./history"), exports);
|
|
19
|
+
__exportStar(require("./log-callback"), exports);
|
|
20
|
+
__exportStar(require("./log-stdout-callback"), exports);
|
|
21
|
+
__exportStar(require("./log"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,iDAA+B;AAC/B,wDAAsC;AACtC,wCAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-callback.js","sourceRoot":"","sources":["../../interfaces/log-callback.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-stdout-callback.js","sourceRoot":"","sources":["../../interfaces/log-stdout-callback.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Moment } from "moment";
|
|
2
|
+
import { LogType } from "./enums";
|
|
3
|
+
export interface ILog {
|
|
4
|
+
date: Moment;
|
|
5
|
+
context: string;
|
|
6
|
+
message: string;
|
|
7
|
+
duration?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ILogError extends ILog {
|
|
10
|
+
readonly type: LogType.error;
|
|
11
|
+
stack?: string;
|
|
12
|
+
error?: Error;
|
|
13
|
+
}
|
|
14
|
+
export interface ILogInfo extends ILog {
|
|
15
|
+
readonly type: LogType.info;
|
|
16
|
+
}
|
|
17
|
+
export interface ILogDebug extends ILog {
|
|
18
|
+
readonly type: LogType.debug;
|
|
19
|
+
}
|
|
20
|
+
export interface ILogWarn extends ILog {
|
|
21
|
+
readonly type: LogType.warn;
|
|
22
|
+
}
|
|
23
|
+
export declare class LogError extends Error implements ILogError {
|
|
24
|
+
message: string;
|
|
25
|
+
date: Moment;
|
|
26
|
+
context: string;
|
|
27
|
+
duration?: number;
|
|
28
|
+
type: LogType.error;
|
|
29
|
+
constructor(message: string, date: Moment, context: string, duration?: number);
|
|
30
|
+
}
|
|
31
|
+
export type Log = ILogInfo | ILogWarn | ILogError | ILogDebug;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogError = void 0;
|
|
4
|
+
const enums_1 = require("./enums");
|
|
5
|
+
class LogError extends Error {
|
|
6
|
+
constructor(message, date, context, duration) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.message = message;
|
|
9
|
+
this.date = date;
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.duration = duration;
|
|
12
|
+
this.type = enums_1.LogType.error;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.LogError = LogError;
|
|
16
|
+
LogError;
|
|
17
|
+
//# sourceMappingURL=log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../interfaces/log.ts"],"names":[],"mappings":";;;AACA,mCAAkC;AAmClC,MAAa,QACV,SAAQ,KAAK;IAKb,YACU,OAAe,EACf,IAAY,EACZ,OAAe,EACf,QAAiB;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,aAAQ,GAAR,QAAQ,CAAS;QAN3B,SAAI,GAAkB,eAAO,CAAC,KAAK,CAAC;IASpC,CAAC;CACH;AAdD,4BAcC;AAOE,QAAQ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loggerSubscribe = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const env_1 = require("./env");
|
|
6
|
+
const loggerSubscribe = (callback) => {
|
|
7
|
+
const id = (0, uuid_1.v4)();
|
|
8
|
+
logger.emitter.on(env_1.logEvent, callback);
|
|
9
|
+
logger.subscriptions[id] = callback;
|
|
10
|
+
return id;
|
|
11
|
+
};
|
|
12
|
+
exports.loggerSubscribe = loggerSubscribe;
|
|
13
|
+
//# sourceMappingURL=logger-subscribe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-subscribe.js","sourceRoot":"","sources":["../logger-subscribe.ts"],"names":[],"mappings":";;;AACA,+BAA0B;AAC1B,+BAAiC;AAE1B,MAAM,eAAe,GAAG,CAC5B,QAAqB,EACtB,EAAE;IACD,MAAM,EAAE,GAAG,IAAA,SAAE,GAAE,CAAC;IAChB,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,cAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;IACpC,OAAO,EAAE,CAAC;AACb,CAAC,CAAA;AAPY,QAAA,eAAe,mBAO3B"}
|
package/logger.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Log } from "./interfaces";
|
|
2
|
+
type Dispatcher = {
|
|
3
|
+
(logEvent: string, data: Log): void;
|
|
4
|
+
};
|
|
5
|
+
export declare class Logger {
|
|
6
|
+
protected context: string;
|
|
7
|
+
protected timer: {
|
|
8
|
+
start: () => void;
|
|
9
|
+
stop: () => number;
|
|
10
|
+
display: (duration: number) => string;
|
|
11
|
+
};
|
|
12
|
+
protected dispatcher: Dispatcher;
|
|
13
|
+
constructor(context: string);
|
|
14
|
+
debug(_: Object): void;
|
|
15
|
+
log(message: string): void;
|
|
16
|
+
error(error: Error): any;
|
|
17
|
+
error(message: string, stack?: string): any;
|
|
18
|
+
warn(message: string): void;
|
|
19
|
+
throw(error: Error): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
package/logger.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
const env_1 = require("./env");
|
|
5
|
+
const interfaces_1 = require("./interfaces");
|
|
6
|
+
const worker_threads_1 = require("worker_threads");
|
|
7
|
+
class Logger {
|
|
8
|
+
constructor(context) {
|
|
9
|
+
var _a;
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.timer = getTimer();
|
|
12
|
+
this.timer.start();
|
|
13
|
+
if (worker_threads_1.isMainThread) {
|
|
14
|
+
this.dispatcher = (event, data) => {
|
|
15
|
+
logger.emitter.emit(event, data);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.dispatcher = (event, data) => {
|
|
20
|
+
worker_threads_1.parentPort.postMessage(JSON.stringify({
|
|
21
|
+
type: 'log',
|
|
22
|
+
event: event,
|
|
23
|
+
data: data
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (((_a = process.env.LOG_LEVEL) === null || _a === void 0 ? void 0 : _a.toLowerCase()) == 'debug') {
|
|
28
|
+
this.debug = (message) => {
|
|
29
|
+
const content = typeof message === 'string'
|
|
30
|
+
? message
|
|
31
|
+
: JSON.stringify(message);
|
|
32
|
+
const data = {
|
|
33
|
+
type: interfaces_1.LogType.debug,
|
|
34
|
+
message: `DEBUG: ${content}`,
|
|
35
|
+
context: this.context,
|
|
36
|
+
date: getNow(),
|
|
37
|
+
duration: this.timer.stop()
|
|
38
|
+
};
|
|
39
|
+
this.dispatcher(env_1.logEvent, data);
|
|
40
|
+
this.timer.start();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
debug(_) { }
|
|
45
|
+
log(message) {
|
|
46
|
+
const data = {
|
|
47
|
+
type: interfaces_1.LogType.info,
|
|
48
|
+
message,
|
|
49
|
+
context: this.context,
|
|
50
|
+
date: getNow(),
|
|
51
|
+
duration: this.timer.stop()
|
|
52
|
+
};
|
|
53
|
+
this.dispatcher(env_1.logEvent, data);
|
|
54
|
+
this.timer.start();
|
|
55
|
+
}
|
|
56
|
+
error(errorOrMessage, stack) {
|
|
57
|
+
const isMessage = typeof (errorOrMessage) === 'string';
|
|
58
|
+
const data = {
|
|
59
|
+
type: interfaces_1.LogType.error,
|
|
60
|
+
message: isMessage
|
|
61
|
+
? errorOrMessage
|
|
62
|
+
: errorOrMessage.message,
|
|
63
|
+
stack: stack,
|
|
64
|
+
error: !isMessage
|
|
65
|
+
? errorOrMessage
|
|
66
|
+
: undefined,
|
|
67
|
+
context: this.context,
|
|
68
|
+
date: getNow(),
|
|
69
|
+
duration: this.timer.stop()
|
|
70
|
+
};
|
|
71
|
+
this.dispatcher(env_1.logEvent, data);
|
|
72
|
+
this.timer.start();
|
|
73
|
+
}
|
|
74
|
+
warn(message) {
|
|
75
|
+
const data = {
|
|
76
|
+
type: interfaces_1.LogType.warn,
|
|
77
|
+
message,
|
|
78
|
+
context: this.context,
|
|
79
|
+
date: getNow(),
|
|
80
|
+
duration: this.timer.stop()
|
|
81
|
+
};
|
|
82
|
+
this.dispatcher(env_1.logEvent, data);
|
|
83
|
+
this.timer.start();
|
|
84
|
+
}
|
|
85
|
+
throw(error) {
|
|
86
|
+
const logError = new interfaces_1.LogError(error.message, getNow(), this.context, this.timer.stop());
|
|
87
|
+
if (error.stack) {
|
|
88
|
+
logError.stack = error.stack;
|
|
89
|
+
}
|
|
90
|
+
throw logError;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.Logger = Logger;
|
|
94
|
+
//# sourceMappingURL=logger.js.map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AAe;QACjB,MAAM,IAAI,GAAG;YACV,IAAI,EAAE,oBAAO,CAAC,IAAI;YAClB,OAAO;YACP,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,MAAM,EAAE;YACd,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;SACtB,CAAC;QACT,IAAI,CAAC,UAAU,CAAC,cAAQ,EAAE,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,KAAY;QACf,MAAM,QAAQ,GACX,IAAI,qBAAQ,CACT,KAAK,CAAC,OAAO,EACb,MAAM,EAAE,EACR,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CACnB,CAAC;QACL,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAChC,CAAC;QACD,MAAM,QAAQ,CAAC;IAClB,CAAC;CACH;AArGD,wBAqGC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rockster/logger",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "index",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"pre:build": "rm -rf ./dist && mkdir ./dist && cp package.json ./dist",
|
|
8
|
+
"build:prod": "npm run pre:build && tsc -p tsconfig.prod.json",
|
|
9
|
+
"build:dev": "npm run pre:build && tsc -p tsconfig.prod.json -w",
|
|
10
|
+
"post:publish": "cd ./dist && npm publish"
|
|
11
|
+
},
|
|
12
|
+
"author": "Hubseat",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://git.hubseat.io/rockster/rockster-logger"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@rockster/common": "0.0.1",
|
|
23
|
+
"colors": "^1.4.0",
|
|
24
|
+
"intercept-stdout": "^0.1.2",
|
|
25
|
+
"moment": "^2.29.4",
|
|
26
|
+
"reflect-metadata": "^0.1.13",
|
|
27
|
+
"uuid": "^9.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/intercept-stdout": "^0.1.0",
|
|
31
|
+
"@types/node": "^20.1.3",
|
|
32
|
+
"@types/uuid": "^9.0.1",
|
|
33
|
+
"typescript": "^5.0.4"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stdoutSubscribe = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const env_1 = require("./env");
|
|
6
|
+
const stdoutSubscribe = (callback) => {
|
|
7
|
+
const id = (0, uuid_1.v4)();
|
|
8
|
+
logger.emitter.on(env_1.stdoutEvent, callback);
|
|
9
|
+
logger.subscriptions[id] = callback;
|
|
10
|
+
return id;
|
|
11
|
+
};
|
|
12
|
+
exports.stdoutSubscribe = stdoutSubscribe;
|
|
13
|
+
//# sourceMappingURL=stdout-subscribe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdout-subscribe.js","sourceRoot":"","sources":["../stdout-subscribe.ts"],"names":[],"mappings":";;;AACA,+BAA0B;AAC1B,+BAAoC;AAE7B,MAAM,eAAe,GAAG,CAC5B,QAA2B,EAC5B,EAAE;IACD,MAAM,EAAE,GAAG,IAAA,SAAE,GAAE,CAAC;IAChB,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,iBAAW,EAAE,QAAQ,CAAC,CAAC;IACzC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;IACpC,OAAO,EAAE,CAAC;AACb,CAAC,CAAA;AAPY,QAAA,eAAe,mBAO3B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Moment } from "moment";
|
|
2
|
+
import { ILogError, ILogWarn, Log } from "./interfaces";
|
|
3
|
+
export declare class StdoutWriter {
|
|
4
|
+
protected timer: {
|
|
5
|
+
start: () => void;
|
|
6
|
+
stop: () => number;
|
|
7
|
+
display: (duration: number) => string;
|
|
8
|
+
};
|
|
9
|
+
protected stackTraceLabel: string;
|
|
10
|
+
protected endStackTraceLabel: string;
|
|
11
|
+
write(log: Log): void;
|
|
12
|
+
protected createLabel(container: string, text: string): string;
|
|
13
|
+
protected getSection(label: string): string;
|
|
14
|
+
protected log(log: Log): void;
|
|
15
|
+
protected printDebug(log: Log): void;
|
|
16
|
+
protected printInfo(log: Log): void;
|
|
17
|
+
protected printError(log: ILogError): void;
|
|
18
|
+
protected printWarn(log: ILogWarn): void;
|
|
19
|
+
protected getStyled(date: string, context: string, duration: string): {
|
|
20
|
+
date: string;
|
|
21
|
+
context: string;
|
|
22
|
+
duration: string;
|
|
23
|
+
processInfo: string;
|
|
24
|
+
};
|
|
25
|
+
protected getDuration(value: number): string;
|
|
26
|
+
protected getMessage(message: any): string;
|
|
27
|
+
protected getBrackets(value: any): string;
|
|
28
|
+
protected formatDate(date: Moment): string;
|
|
29
|
+
}
|
package/stdout-writer.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StdoutWriter = void 0;
|
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
const interfaces_1 = require("./interfaces");
|
|
9
|
+
const get_error_infos_1 = require("./functions/get-error-infos");
|
|
10
|
+
const isStringOrNumber = (value) => {
|
|
11
|
+
return typeof value === 'number'
|
|
12
|
+
|| typeof value === 'string';
|
|
13
|
+
};
|
|
14
|
+
class StdoutWriter {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.timer = getTimer();
|
|
17
|
+
this.stackTraceLabel = this
|
|
18
|
+
.createLabel('-', 'STACK TRACE')
|
|
19
|
+
.bgRed;
|
|
20
|
+
this.endStackTraceLabel = this
|
|
21
|
+
.createLabel('-', 'END STACK TRACE')
|
|
22
|
+
.bgRed;
|
|
23
|
+
}
|
|
24
|
+
write(log) {
|
|
25
|
+
this.log(log);
|
|
26
|
+
}
|
|
27
|
+
createLabel(container, text) {
|
|
28
|
+
let label = '';
|
|
29
|
+
const columns = (process.stdout.columns - text.length) / 2;
|
|
30
|
+
const sideLength = columns % 2 === 0
|
|
31
|
+
? columns
|
|
32
|
+
: columns - 1;
|
|
33
|
+
for (let i = 0; i < sideLength; i++) {
|
|
34
|
+
label += container[0];
|
|
35
|
+
}
|
|
36
|
+
label += text;
|
|
37
|
+
for (let i = 0; i < sideLength; i++) {
|
|
38
|
+
label += container[0];
|
|
39
|
+
}
|
|
40
|
+
return label;
|
|
41
|
+
}
|
|
42
|
+
getSection(label) {
|
|
43
|
+
return this.createLabel('-', label);
|
|
44
|
+
}
|
|
45
|
+
log(log) {
|
|
46
|
+
switch (log.type) {
|
|
47
|
+
case interfaces_1.LogType.info:
|
|
48
|
+
return this.printInfo(log);
|
|
49
|
+
case interfaces_1.LogType.error:
|
|
50
|
+
return this.printError(log);
|
|
51
|
+
case interfaces_1.LogType.warn:
|
|
52
|
+
return this.printWarn(log);
|
|
53
|
+
case interfaces_1.LogType.debug:
|
|
54
|
+
return this.printDebug(log);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
printDebug(log) {
|
|
58
|
+
var _a;
|
|
59
|
+
const message = (_a = this
|
|
60
|
+
.getMessage(log.message)) === null || _a === void 0 ? void 0 : _a.gray;
|
|
61
|
+
const { date, context, duration, processInfo } = this
|
|
62
|
+
.getStyled(this.formatDate(log.date), log.context, this.getDuration(log.duration));
|
|
63
|
+
process.stdout.write(`${processInfo}${date}${context} ${message} ${duration}\n`);
|
|
64
|
+
}
|
|
65
|
+
printInfo(log) {
|
|
66
|
+
var _a;
|
|
67
|
+
const message = (_a = this
|
|
68
|
+
.getMessage(log.message)) === null || _a === void 0 ? void 0 : _a.green;
|
|
69
|
+
const { date, context, duration, processInfo } = this
|
|
70
|
+
.getStyled(this.formatDate(log.date), log.context, this.getDuration(log.duration));
|
|
71
|
+
process.stdout.write(`${processInfo}${date}${context} ${message} ${duration}\n`);
|
|
72
|
+
}
|
|
73
|
+
printError(log) {
|
|
74
|
+
var _a;
|
|
75
|
+
const message = (_a = this.getMessage(log.message)) === null || _a === void 0 ? void 0 : _a.red;
|
|
76
|
+
const { date, context, duration, processInfo } = this
|
|
77
|
+
.getStyled(this.formatDate(log.date), log.context, this.getDuration(log.duration));
|
|
78
|
+
const text = `${processInfo}${date}${context} ${message} ${duration}\n`;
|
|
79
|
+
process.stdout.write(text);
|
|
80
|
+
if (log.error) {
|
|
81
|
+
const textSection = this.getSection('ERROR DETAILS').bgRed + '\n';
|
|
82
|
+
process.stdout.write(textSection);
|
|
83
|
+
const errorInfos = (0, get_error_infos_1.getErrorInfos)(log.error);
|
|
84
|
+
const detailedText = errorInfos.message.red;
|
|
85
|
+
process.stdout.write(detailedText);
|
|
86
|
+
log.error = errorInfos.values;
|
|
87
|
+
const stackText = `${log.error.stack.replace(`${log.message}\n`, '').grey.italic}\n`;
|
|
88
|
+
process.stdout.write(stackText);
|
|
89
|
+
const endTextSection = this.getSection('END ERROR DETAILS').bgRed + '\n';
|
|
90
|
+
process.stdout.write(endTextSection);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (log.stack) {
|
|
94
|
+
const stackLabel = this.getSection('STACK TRACE').bgRed + '\n';
|
|
95
|
+
process.stdout.write(stackLabel);
|
|
96
|
+
const stackText = `${log.stack.replace(`${log.message}\n`, '').grey.italic}\n`;
|
|
97
|
+
process.stdout.write(stackText);
|
|
98
|
+
const endStack = this.getSection('END STACK TRACE').bgRed + '\n';
|
|
99
|
+
process.stdout.write(endStack);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
printWarn(log) {
|
|
103
|
+
var _a;
|
|
104
|
+
const message = (_a = this.getMessage(log.message)) === null || _a === void 0 ? void 0 : _a.magenta;
|
|
105
|
+
const { date, context, duration, processInfo } = this
|
|
106
|
+
.getStyled(this.formatDate(log.date), log.context, this.getDuration(log.duration));
|
|
107
|
+
process.stdout.write(`${processInfo}${date}${context} ${message} ${duration}\n`);
|
|
108
|
+
}
|
|
109
|
+
getStyled(date, context, duration) {
|
|
110
|
+
var _a;
|
|
111
|
+
return {
|
|
112
|
+
date: `${date} `,
|
|
113
|
+
context: this.getBrackets(context).yellow,
|
|
114
|
+
duration: (_a = this.getBrackets(duration)) === null || _a === void 0 ? void 0 : _a.yellow,
|
|
115
|
+
processInfo: `[${logger.name}] ${process.pid} - `.green
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
getDuration(value) {
|
|
119
|
+
if (value) {
|
|
120
|
+
return `+${this.timer.display(value)}`;
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
getMessage(message) {
|
|
125
|
+
if (!isStringOrNumber(message)) {
|
|
126
|
+
if (typeof message === 'function')
|
|
127
|
+
return message === null || message === void 0 ? void 0 : message.toString();
|
|
128
|
+
return JSON.stringify(message);
|
|
129
|
+
}
|
|
130
|
+
return String(message);
|
|
131
|
+
}
|
|
132
|
+
getBrackets(value) {
|
|
133
|
+
return !isNullOrUndefined(value)
|
|
134
|
+
? `[${value}]`
|
|
135
|
+
: '';
|
|
136
|
+
}
|
|
137
|
+
formatDate(date) {
|
|
138
|
+
if (typeof date === 'string') {
|
|
139
|
+
return (0, moment_1.default)(date).format(logger.dataFormat);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
return date.format(logger.dataFormat);
|
|
143
|
+
}
|
|
144
|
+
;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.StdoutWriter = StdoutWriter;
|
|
148
|
+
//# sourceMappingURL=stdout-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdout-writer.js","sourceRoot":"","sources":["../stdout-writer.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAwC;AACxC,6CAKsB;AACtB,iEAA4D;AAE5D,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,EAAE;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ;WAC7B,OAAO,KAAK,KAAK,QAAQ,CAAC;AAChC,CAAC,CAAC;AAEF,MAAa,YAAY;IAAzB;QAEa,UAAK,GAAG,QAAQ,EAAE,CAAC;QACnB,oBAAe,GAAG,IAAI;aAC5B,WAAW,CAAC,GAAG,EAAE,aAAa,CAAC;aAC/B,KAAK,CAAC;QACA,uBAAkB,GAAG,IAAI;aAC/B,WAAW,CAAC,GAAG,EAAE,iBAAiB,CAAC;aACnC,KAAK,CAAC;IAuLb,CAAC;IArLE,KAAK,CAAC,GAAQ;QACX,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAES,WAAW,CAAC,SAAiB,EAAE,IAAY;QAClD,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3D,MAAM,UAAU,GAAG,OAAO,GAAG,CAAC,KAAK,CAAC;YACjC,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,OAAO,GAAE,CAAC,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;QACD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