1
0
mirror of https://git.stamm.me/OpenServer/NodeLogging.git synced 2024-11-25 07:59:23 +00:00

Removing conole Color symbols in Logfiles

This commit is contained in:
Fabian Stamm 2017-11-04 23:58:00 +01:00
parent 82cff60b68
commit 0fd6efac99
2 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "logger-perfcloud", "name": "logger-perfcloud",
"version": "1.0.8", "version": "1.0.9",
"description": "", "description": "",
"main": "out/index.js", "main": "out/index.js",
"types": "out/index.d.ts", "types": "out/index.d.ts",

View File

@ -114,6 +114,14 @@ export class Logging {
} }
var m = "[" + LoggingTypes[type] + "][" + _getCallerFile() + "][" + new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '') + "]: " + mb; var m = "[" + LoggingTypes[type] + "][" + _getCallerFile() + "][" + new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '') + "]: " + mb;
if (this.stdout) console.log(consoleLogFormat + m + Reset);
let index = m.indexOf("\x1b");
while (index >= 0) {
m = m.substring(0, index) + m.substring(index + 4, m.length);
index = m.indexOf("\x1b");
}
if (this.logFileLocation) { if (this.logFileLocation) {
if (!this.fileStream || !this.errorStream) { if (!this.fileStream || !this.errorStream) {
await Logging.initializeFile(); await Logging.initializeFile();
@ -121,7 +129,6 @@ export class Logging {
Logging.writeMessageToFile(m, type === LoggingTypes.Error); Logging.writeMessageToFile(m, type === LoggingTypes.Error);
} }
Logging.events.emit("message", { type: type, message: mb }); Logging.events.emit("message", { type: type, message: mb });
if (this.stdout) console.log(consoleLogFormat + m + Reset);
} }
private static writeMessageToFile(message: string, error?: boolean) { private static writeMessageToFile(message: string, error?: boolean) {