mirror of
https://git.stamm.me/OpenServer/NodeLogging.git
synced 2024-11-15 02:11:04 +00:00
Improving Logging output.
This commit is contained in:
parent
0f3dc07dff
commit
fbb55fa158
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hibas123/nodelogging",
|
"name": "@hibas123/nodelogging",
|
||||||
"version": "1.3.21",
|
"version": "1.4.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"types": "out/index.d.ts",
|
"types": "out/index.d.ts",
|
||||||
|
@ -277,12 +277,12 @@ export class LoggingBase {
|
|||||||
}
|
}
|
||||||
let file = caller || getCallerFile();
|
let file = caller || getCallerFile();
|
||||||
let date = new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
let date = new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||||
let prefix = `[${LoggingTypes[type]}][${file.file}:${file.line}][${date}]: `;
|
let prefix = `[ ${date} ][${LoggingTypes[type].toUpperCase()}][${file.file}:${String(file.line).padEnd(3, " ")}]: `;
|
||||||
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 name = "";
|
let name = "";
|
||||||
if (this.config.name) name = `[${this.config.name}]`;
|
if (this.config.name) name = `[${this.config.name}]=>`;
|
||||||
message_lines.forEach(line => console.log(consoleLogFormat + name + line + Colors.Reset));
|
message_lines.forEach(line => console.log(consoleLogFormat + name + line + Colors.Reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user