I'm very new to backend web dev and I'm trying to set up a TypeScript project. Most everything else seems fine but when I try to use the Pino
logger, I get this error in the compiled levels.js
file:
throw Error(`default level:${defaultLevel} must be included in custom levels`)
My logger.ts
looks like this:
1 import pino from 'pino';
2
3 const l = pino({
4 name: process.env.APP_ID,
5 level: process.env.LOG_LEVEL,
6 });
7
8 export default l;
The project was bootstrapped via yeoman
.
Not sure if that's enough to debug the issue.
I feel dumb. The issue was that the generator didn't create a .env
; where all those variables should have been defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With