Refactoring
This commit is contained in:
parent
a3130f8a89
commit
c7ab71aea6
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@hibas123/nodelogging",
|
"name": "@hibas123/nodelogging",
|
||||||
"version": "1.3.19",
|
"version": "1.3.10",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"types": "out/index.d.ts",
|
"types": "out/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"prepublish": "tsc",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"watch": "tsc --watch",
|
"watch": "tsc --watch",
|
||||||
"test": "node out/test.js",
|
"test": "node out/test.js",
|
||||||
|
@ -281,9 +281,9 @@ export class LoggingBase {
|
|||||||
let message_lines = mb.split("\n").map(line => prefix + line);
|
let message_lines = mb.split("\n").map(line => prefix + line);
|
||||||
|
|
||||||
if (this.config.console_out) {
|
if (this.config.console_out) {
|
||||||
let prefix = "";
|
let name = "";
|
||||||
if (this.config.name) prefix = `[${this.config.name}]`;
|
if (this.config.name) name = `[${this.config.name}]`;
|
||||||
message_lines.forEach(line => console.log(consoleLogFormat + prefix + line + Colors.Reset));
|
message_lines.forEach(line => console.log(consoleLogFormat + name + line + Colors.Reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
let m = message_lines.join("\n");
|
let m = message_lines.join("\n");
|
||||||
@ -303,7 +303,7 @@ export class LoggingBase {
|
|||||||
if (this.logFile) {
|
if (this.logFile) {
|
||||||
this.logFile.write(data);
|
this.logFile.write(data);
|
||||||
}
|
}
|
||||||
this.events.emit("message", { type: type, message: data.toString("utf8") });
|
this.events.emit("message", { type: type, message: m, module: this.config.name });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user