Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pino: default level undefined

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.

like image 874
DSchana Avatar asked Nov 06 '18 00:11

DSchana


1 Answers

I feel dumb. The issue was that the generator didn't create a .env; where all those variables should have been defined.

like image 116
DSchana Avatar answered Oct 28 '22 23:10

DSchana