feat: Add stack trace utility and enhance logging across various modules

This commit is contained in:
2024-12-31 15:14:30 +08:00
parent 5131515770
commit 730b673954
15 changed files with 311 additions and 54 deletions

View File

@@ -377,3 +377,8 @@ export function replaceExtname(path: string, ext: string) {
}
return path.slice(0, path.length - extname(path).length) + ext;
}
export function stackTrace(skip: number = 0) {
const err = new Error();
return err.stack?.split("\n").slice(2 + skip).join("\n");
}