Compare commits

...

2 Commits

Author SHA1 Message Date
Fabian Stamm
ce8ecbe8c9 Fixing wrong version 2018-10-29 09:10:56 +01:00
Fabian Stamm
c7ab71aea6 Refactoring 2018-10-29 09:05:30 +01:00
4 changed files with 11 additions and 10 deletions

View File

@ -240,10 +240,10 @@ class LoggingBase {
let prefix = `[${LoggingTypes[type]}][${file.file}:${file.line}][${date}]: `;
let message_lines = mb.split("\n").map(line => prefix + line);
if (this.config.console_out) {
let prefix = "";
let name = "";
if (this.config.name)
prefix = `[${this.config.name}]`;
message_lines.forEach(line => console.log(consoleLogFormat + prefix + line + exports.Colors.Reset));
name = `[${this.config.name}]`;
message_lines.forEach(line => console.log(consoleLogFormat + name + line + exports.Colors.Reset));
}
let m = message_lines.join("\n");
m = m.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
@ -259,7 +259,7 @@ class LoggingBase {
if (this.logFile) {
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 });
}
}
exports.LoggingBase = LoggingBase;

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,11 @@
{
"name": "@hibas123/nodelogging",
"version": "1.3.19",
"version": "1.3.20",
"description": "",
"main": "out/index.js",
"types": "out/index.d.ts",
"scripts": {
"prepublish": "tsc",
"build": "tsc",
"watch": "tsc --watch",
"test": "node out/test.js",

View File

@ -281,9 +281,9 @@ export class LoggingBase {
let message_lines = mb.split("\n").map(line => prefix + line);
if (this.config.console_out) {
let prefix = "";
if (this.config.name) prefix = `[${this.config.name}]`;
message_lines.forEach(line => console.log(consoleLogFormat + prefix + line + Colors.Reset));
let name = "";
if (this.config.name) name = `[${this.config.name}]`;
message_lines.forEach(line => console.log(consoleLogFormat + name + line + Colors.Reset));
}
let m = message_lines.join("\n");
@ -303,7 +303,7 @@ export class LoggingBase {
if (this.logFile) {
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 });
}
}