-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Absolute paths using ES modules in Node #99
Comments
Did you get any solution? |
No, I haven't tried anymore and moved to pino |
I found that Stripping it in cleanUpFilePath seems to restore functionality as documented. If this is a possible solution, I'm happy to open a PR |
I just noticed that Code Frame is also not printed when using ES Modules. Modifying LoggerHelper.ts#L75 instead restores both relative paths and code frames: const filePath: string | null = stackFrame.getFileName().replace("file://", ""); |
Yes, a PR would be great! Thanks for this hint! 👍🏻 |
Fixes #99 - Handle ESM Stackframe Filepath
Describe the bug
In the module description, it says
Using node ES modules in an express project, the paths are not relative, but absolute from the system root.
To Reproduce
The logger module file is below
Using it like the following:
The output is
Expected behavior
The paths being relative from the project root.
Additional context
This happens both when running with node and
nodemon
.Node.js Version
14.15.3
npm Version
7.9.0
OS incl. Version
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: