diff --git a/package.json b/package.json index 0ce58ce..cb0d26b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/base.ts b/src/base.ts index b320156..1e3f4fc 100644 --- a/src/base.ts +++ b/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 || ""}:${file_raw.line}:${ + file_raw.column || 0 + }`; let type_str = LoggingTypes[type].toUpperCase().padEnd(5, " "); let type_format: Format[] = [];