Fix bug with undefined file causing logging to throw an exception
This commit is contained in:
parent
511bdf127f
commit
4420fb13ea
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hibas123/logging",
|
||||
"version": "2.4.2",
|
||||
"version": "2.4.3",
|
||||
"description": "",
|
||||
"main": "out/index.js",
|
||||
"types": "out/index.d.ts",
|
||||
|
10
src/base.ts
10
src/base.ts
@ -334,7 +334,11 @@ export class LoggingBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (PROJECT_ROOT && file_raw.file.startsWith(PROJECT_ROOT)) {
|
||||
if (
|
||||
PROJECT_ROOT &&
|
||||
file_raw.file &&
|
||||
file_raw.file.startsWith(PROJECT_ROOT)
|
||||
) {
|
||||
let newF = file_raw.file.substring(PROJECT_ROOT.length);
|
||||
|
||||
if (newF.startsWith("/") || newF.startsWith("\\"))
|
||||
@ -342,7 +346,9 @@ export class LoggingBase {
|
||||
|
||||
file_raw.file = newF;
|
||||
}
|
||||
let file = `${file_raw.file}:${file_raw.line}:${file_raw.column || 0}`;
|
||||
let file = `${file_raw.file || "<unknown>"}:${file_raw.line}:${
|
||||
file_raw.column || 0
|
||||
}`;
|
||||
|
||||
let type_str = LoggingTypes[type].toUpperCase().padEnd(5, " ");
|
||||
let type_format: Format[] = [];
|
||||
|
Loading…
Reference in New Issue
Block a user