Last active
January 18, 2022 15:13
-
-
Save raimohanska/cf0ef4790c1a09044181aac9dbba7850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nextJs from "next" | |
async function createNextAppWithCustomLogging() { | |
const nextApp = nextJs({ dev: false }) | |
const server = (await (nextApp as any).getServer()) as any | |
if (!(server.logError instanceof Function)) throw Error("Assertion fail") | |
server.logError = (err: Error) => { | |
logger.error(err) | |
} | |
return nextApp | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: works only when not running Next.js in dev mode, that's why there's
dev: false
.