{"_id":"@codecademy/next-logger","_rev":"5-e58cdab3a1f800367852e537f41d4706","name":"@codecademy/next-logger","dist-tags":{"latest":"2.2.0"},"versions":{"2.1.0":{"name":"@codecademy/next-logger","version":"2.1.0","keywords":["next.js","next","logging","logger","log","json"],"author":{"name":"Chris Atkin"},"license":"MIT","_id":"@codecademy/next-logger@2.1.0","maintainers":[{"name":"codecademy","email":"dev@codecademy.com"}],"homepage":"https://github.com/codecademy/next-logger#readme","bugs":{"url":"https://github.com/codecademy/next-logger/issues"},"dist":{"shasum":"377bd830c2f13b310d015da6e0695592f0238806","tarball":"https://registry.npmjs.org/@codecademy/next-logger/-/next-logger-2.1.0.tgz","fileCount":8,"integrity":"sha512-hgZw9WaRUibA7+IZlkwJJPQBUnNGvqRPt6ABm4SbVLrC26tc3uhTzh74DE64/klc7FeSWf3UhwQg/Q5Vx7d6hA==","signatures":[{"sig":"MEQCIF95OerGCKcljLFmfcfzP8ciStslLXgqEAlspaFYKOFbAiA/tjE2bhoIIIxaSVSnoNZRPEjITzhiWJUxyEytM8woXg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6538,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhORBQCRA9TVsSAnZWagAATbgP/0IbTp63bQyU3aNsjxBj\nRZIsIP0/9AuOu4eM17NBfivTO0eT0Vmh3UrU/nodWv8ZlCtuM2pLAcmbjh31\nBjRtgWkg0MLqXaraaF537scLEQJatq8It69059f3OqMA0inMkRLoWE3E42aa\nO09VQbw/+tD5Jrodnp0k36Oanv4FeA9xzOd4qsi1fiLZfvR1C3XTf1+74mRe\nRbZdjcTIYHXfZpFZbK3fSXZCeCB0u4GZUss13XVRLhJM+lkE/6dMhmNE6U9i\nknS+hTwbuPA5Q7Kz8l5B4EIDkDddDuMcCGnkdDLplaf+g2iBnHOQNyseWvxK\nUhg+FqJhMPaAPw0YkJf0QLPFseSfh6TWCMX4pHcaWyLUDE6kY/MaNI5Ymxb+\nLpwqdnuji/zh8uha5PVO9+oj4jn4wSZPeYrvoeMxnNsk+KOjXT9hQHLIzQKy\nbY5cunW0hjyxMScrXfXDuotDVmpsplIS8Qw3BjcgvY6sSwRU+s1Ig14UVzIV\nU5UQhaKar5d+UKHnckw7KJsHjojVcR2QzPN6jL4I+mQGKcPeciac29htMLXq\nTL652uU4aJ5K+hn2WvUM1bGod3RCZ3CiZoNwMwvgft4EIFbT7uR0b+NE7y0Q\nmFVws5AKrIvQgRUBtUm6EBgbtu+MxiyoYlcfauOps0DLxWzimRzHy9KvnEvM\n+X7D\r\n=hXhy\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"resetMocks":true,"resetModules":true,"errorOnDeprecated":true},"main":"index.js","gitHead":"036b59722e36b37c437c2c6b1866034ede50e835","scripts":{"lint":"eslint .","test":"jest --runInBand"},"_npmUser":{"name":"codecademy","email":"dev@codecademy.com"},"repository":{"url":"git+https://github.com/codecademy/next-logger.git","type":"git"},"_npmVersion":"6.14.15","description":"JSON logging patcher for Next.js","directories":{},"_nodeVersion":"14.17.6","dependencies":{"pino":"^6.8.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","next":"^11.1.0","eslint":"^7.31.0","prettier":"^2.3.2","eslint-plugin-jest":"^24.4.0","eslint-plugin-import":"^2.23.4","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","eslint-config-airbnb-base":"^14.2.1"},"peerDependencies":{"next":">=9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/next-logger_2.1.0_1631129679996_0.8738165326277323","host":"s3://npm-registry-packages"}},"2.2.0":{"name":"@codecademy/next-logger","version":"2.2.0","keywords":["next.js","next","logging","logger","log","json"],"author":{"name":"Chris Atkin","email":"atkinchris@gmail.com"},"license":"MIT","_id":"@codecademy/next-logger@2.2.0","maintainers":[{"name":"codecademy","email":"dev@codecademy.com"}],"homepage":"https://github.com/atkinchris/next-logger#readme","bugs":{"url":"https://github.com/atkinchris/next-logger/issues"},"dist":{"shasum":"878bbb43b67818fa18235eb7f514660928cb125e","tarball":"https://registry.npmjs.org/@codecademy/next-logger/-/next-logger-2.2.0.tgz","fileCount":8,"integrity":"sha512-VKEeSXEQ0MgK6oGFwFzesoXYelBV5KjL33OCIsajiQ0jY//aiBdxLo+zfkzxUIERkaKjUVFDfWwblVT5o3eO5g==","signatures":[{"sig":"MEUCIQDXIS9HZToj8yR0Z8TASG6qBoG4XRtRKSy+ggBCvxtM9QIgVdvO309Hx+K5S9n9JnJ/nC4BZBEj+8WSTE/34tG1PPg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6340,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHjLQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpTURAAjgojNatqSK7aP0j70w5k3sxsN4jWl2oRdyUFEHHOMmXR9B17\r\nZ+9OVEBWJaQARMrE8B+d+LbFYwDoJjmEGYMI5y1ypFb+vCb/V2JW8+xWAY9g\r\nCCsSSKk+8s/qxYHdZLKhkask3hJnAMyx41LEm+0wkFNb8IJkZeSn8fG/nsuL\r\nZ68m6duadvxzOmScniWn9hBo4QW6THB11SMI05tY6v/yl2IsJ4HLf2ST8CzN\r\n10TqZ1Chr1UlD5211eOsSdbN6fJqZZ5B/dyjhgWd3iRQecm6bP+YdIJf+fLx\r\nelzbQLmifCUr5h1hXPugh2mkKeP1TkPjvnz8qYv3hkx09sheIFvAO/GG3GO+\r\ngqxau0Tb7sw9sdxa9XRKT43HGbQd3NF93fPOHtCxQZM+Wi/6j7SfeSmh3uo8\r\nVuyZQZdMOtbIJCh+4hAz8v3qPoe7KQ4x7uK9ApQBrn5OuWn1L5Z+x6mmKQYT\r\nlo8kl//UJ6f8RJhHb1fkfJj9MVLKl+eQwgEMg1mFP4Xef7cnjHEn35GIzq0Z\r\n2aXSRJaTQkArPNu5nO3KVBkp56lxTyT/hZlNw6n/Q5wWppQBXjQi798ITw4L\r\nRqwnzsRr/HRNK+bwUCIBpBuQpuHRDTlxsLPeRb5w23NalLsUxzNhBghuJxGw\r\ngV/eB+K7Gb8BwiDdhxQq7z74Fc7m6NjFugo=\r\n=tKB6\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"resetMocks":true,"resetModules":true,"errorOnDeprecated":true},"main":"index.js","gitHead":"5a6f8af616f8afafce4f5673bb699e5c8fd4a6cd","scripts":{"lint":"eslint .","test":"jest --runInBand"},"_npmUser":{"name":"codecademy","email":"dev@codecademy.com"},"repository":{"url":"git+https://github.com/atkinchris/next-logger.git","type":"git"},"_npmVersion":"6.14.16","description":"JSON logging patcher for Next.js","directories":{},"_nodeVersion":"14.19.0","dependencies":{"pino":"^7.8.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","next":"^11.1.0","eslint":"^7.31.0","prettier":"^2.3.2","eslint-plugin-jest":"^24.4.0","eslint-plugin-import":"^2.23.4","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","eslint-config-airbnb-base":"^14.2.1"},"peerDependencies":{"next":">=9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/next-logger_2.2.0_1646146256311_0.5883281454998013","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-09-08T19:34:39.995Z","modified":"2025-12-09T21:50:56.747Z","2.1.0":"2021-09-08T19:34:40.141Z","2.2.0":"2022-03-01T14:50:56.462Z"},"bugs":{"url":"https://github.com/atkinchris/next-logger/issues"},"author":{"name":"Chris Atkin","email":"atkinchris@gmail.com"},"license":"MIT","homepage":"https://github.com/atkinchris/next-logger#readme","keywords":["next.js","next","logging","logger","log","json"],"repository":{"url":"git+https://github.com/atkinchris/next-logger.git","type":"git"},"description":"JSON logging patcher for Next.js","maintainers":[{"email":"dev@codecademy.com","name":"codecademy-eng"}],"readme":"# next-logger\n\nJSON logging patcher for Next.js\n\n## Description\n\nThis is a library to patch the logging functions used by [Next.js](https://nextjs.org/), to have them output to `stdout` as newline-delimited JSON. This allows a Next.js application to log service events in a format that's compatible with log aggregators, without needing a custom Next.js server.\n\nThis works by importing Next.js' inbuilt [logger](https://github.com/vercel/next.js/blob/canary/packages/next/build/output/log.ts) via `require`, and replacing the logging methods with custom ones. It uses [`pino`](https://github.com/pinojs/pino) to output JSON formatted logs, preserving Next.js' message and prefix, but adding timestamp, hostname and more.\n\nFrom v2.0.0 onwards, this library also patches the global `console` methods, to catch additional logs that Next.js makes directly to `console`. While `pino` logging remains intact, this may cause issues with other libraries which patch or use `console` methods. Use the `next-only` preset to opt-out of this patching.\n\n## Example Logs\n\nBefore:\n\n```sh\nready - started server on http://localhost:3000\ninfo  - Using external babel configuration from .babelrc\nevent - compiled successfully\n```\n\nAfter:\n\n```json\n{\"level\":30,\"time\":1609160882850,\"pid\":18493,\"hostname\":\"MyHostname\",\"name\":\"next.js\",\"msg\":\"started server on http://localhost:3000\",\"prefix\":\"ready\"}\n{\"level\":30,\"time\":1609160883607,\"pid\":18493,\"hostname\":\"MyHostname\",\"name\":\"next.js\",\"msg\":\"Using external babel configuration from .babelrc\",\"prefix\":\"info\"}\n{\"level\":30,\"time\":1609160885675,\"pid\":18493,\"hostname\":\"MyHostname\",\"name\":\"next.js\",\"msg\":\"compiled successfully\",\"prefix\":\"event\"}\n```\n\n## Usage\n\nFirst, install this package. You can do this with whatever Node package manager you're using in your project.\n\n```sh\nnpm install next-logger\n\n# or for Yarn\n\nyarn add next-logger\n```\n\nThen add a [`NODE_OPTIONS`](https://nextjs.org/docs/api-reference/cli) string to your Next.js start script, to require in the logger.\n\n```sh\nNODE_OPTIONS='-r next-logger' next start\n```\n\n### Adding to `package.json` Scripts\n\nYou can add this directly to your `package.json` scripts, to make it easier to start your service.\n\n```json\n\"scripts\": {\n  \"start\": \"NODE_OPTIONS='-r next-logger' next start\",\n  // ...your other scripts\n},\n```\n\n### Presets\n\nTo support opting out of some patches, this library supports \"presets\". These can be used as above, with `/presets/<PRESET_NAME>` appended, for example: `NODE_OPTIONS='-r next-logger/presets/next-only'`.\n\nThe following presets are supported:\n\n- `next-logger/presets/all` - this includes all the patches this library supports. Using the library without a preset specified will use this preset.\n- `next-logger/presets/next-only` - this only includes patches specifically for the Next.js logger object.\n\n## Breaking Changes on >=1.0.0\n\nThis package name, `next-logger` has been inherited from [@frank47](https://github.com/franky47), who had deprecated their published logging middleware for Next.js. The original package and this one aim to solve similar problems for JSON logging in Next.js. However, the implementation and usage of this solution is significantly different from the original, which was published up to `v0.4.0`. To minimise unexpected issues for previous users of the original `next-logger`, the new package begins at major `v1.0.0`.\n","readmeFilename":"README.md"}