sainsburys-tech / next-logger

JSON logging patcher for Next.js
MIT License
144 stars 14 forks source link

Is there a way to configure next-logger in javascript/TS instead of NODE_OPTIONS? #25

Closed eloisetaylor5693 closed 3 months ago

eloisetaylor5693 commented 6 months ago

We have a need to configure another value in NODE_OPTIONS, which we were going to set at deploy time instead of in an npm script

in our package.json we have this script:

"start": "NODE_OPTIONS='-r dd-trace/init -r next-logger --max-old-space-size=2048' NODE_ENV=production yarn server",

We want to set max-old-space-size during deployment using NODE_OPTIONS, but that would mean the next-logger initialisation is wiped out. In dd-trace package we can initialise in code as well, so can replace the node option with code.

atkinchris commented 6 months ago

Having multiple module requires (-r) in NODE_OPTIONS is permitted; they'll each get required when your code starts, before Next.js is invoked.