Skip to content

Commit

Permalink
Update logger to remove process
Browse files Browse the repository at this point in the history
  • Loading branch information
havfo committed Mar 22, 2023
1 parent 523db00 commit f11c637
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
13 changes: 6 additions & 7 deletions lib/Logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ const debug_1 = require("debug");
const APP_NAME = 'edumeet';
class Logger {
constructor(prefix) {
var _a, _b, _c, _d, _e, _f;
_Logger_debug.set(this, void 0);
_Logger_warn.set(this, void 0);
_Logger_error.set(this, void 0);
if (prefix) {
__classPrivateFieldSet(this, _Logger_debug, (0, debug_1.default)(`${(_a = process.title) !== null && _a !== void 0 ? _a : APP_NAME}:DEBUG:${prefix}`), "f");
__classPrivateFieldSet(this, _Logger_warn, (0, debug_1.default)(`${(_b = process.title) !== null && _b !== void 0 ? _b : APP_NAME}:WARN:${prefix}`), "f");
__classPrivateFieldSet(this, _Logger_error, (0, debug_1.default)(`${(_c = process.title) !== null && _c !== void 0 ? _c : APP_NAME}:ERROR:${prefix}`), "f");
__classPrivateFieldSet(this, _Logger_debug, (0, debug_1.default)(`${APP_NAME}:DEBUG:${prefix}`), "f");
__classPrivateFieldSet(this, _Logger_warn, (0, debug_1.default)(`${APP_NAME}:WARN:${prefix}`), "f");
__classPrivateFieldSet(this, _Logger_error, (0, debug_1.default)(`${APP_NAME}:ERROR:${prefix}`), "f");
}
else {
__classPrivateFieldSet(this, _Logger_debug, (0, debug_1.default)(`${(_d = process.title) !== null && _d !== void 0 ? _d : APP_NAME}:DEBUG`), "f");
__classPrivateFieldSet(this, _Logger_warn, (0, debug_1.default)(`${(_e = process.title) !== null && _e !== void 0 ? _e : APP_NAME}:WARN`), "f");
__classPrivateFieldSet(this, _Logger_error, (0, debug_1.default)(`${(_f = process.title) !== null && _f !== void 0 ? _f : APP_NAME}:ERROR`), "f");
__classPrivateFieldSet(this, _Logger_debug, (0, debug_1.default)(`${APP_NAME}:DEBUG`), "f");
__classPrivateFieldSet(this, _Logger_warn, (0, debug_1.default)(`${APP_NAME}:WARN`), "f");
__classPrivateFieldSet(this, _Logger_error, (0, debug_1.default)(`${APP_NAME}:ERROR`), "f");
}
/* eslint-disable no-console */
__classPrivateFieldGet(this, _Logger_debug, "f").log = console.info.bind(console);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edumeet-common",
"version": "0.3.1",
"version": "0.3.2",
"description": "Common code for edumeet",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
12 changes: 6 additions & 6 deletions src/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export class Logger {

constructor(prefix?: string) {
if (prefix) {
this.#debug = debug(`${process.title ?? APP_NAME}:DEBUG:${prefix}`);
this.#warn = debug(`${process.title ?? APP_NAME}:WARN:${prefix}`);
this.#error = debug(`${process.title ?? APP_NAME}:ERROR:${prefix}`);
this.#debug = debug(`${APP_NAME}:DEBUG:${prefix}`);
this.#warn = debug(`${APP_NAME}:WARN:${prefix}`);
this.#error = debug(`${APP_NAME}:ERROR:${prefix}`);
} else {
this.#debug = debug(`${process.title ?? APP_NAME}:DEBUG`);
this.#warn = debug(`${process.title ?? APP_NAME}:WARN`);
this.#error = debug(`${process.title ?? APP_NAME}:ERROR`);
this.#debug = debug(`${APP_NAME}:DEBUG`);
this.#warn = debug(`${APP_NAME}:WARN`);
this.#error = debug(`${APP_NAME}:ERROR`);
}

/* eslint-disable no-console */
Expand Down

0 comments on commit f11c637

Please # to comment.