chore(preview service): improve logging

This commit is contained in:
Iain Sproat
2025-04-08 10:57:12 +01:00
parent dc88cceb32
commit bbadd643b9
2 changed files with 16 additions and 1 deletions
@@ -80,6 +80,21 @@ const pageFunction = async ({
logger.error({ err }, 'Page crashed')
throw err
})
page.on('console', (msg) => {
switch (msg.type()) {
case 'debug':
logger.debug(msg.text())
case 'error':
logger.error({ err: msg }, 'Page error')
break
case 'warn':
logger.warn({ err: msg }, msg.text())
break
default:
logger.info({ msg }, msg.text())
break
}
})
await page.goto(`http://127.0.0.1:${port}/index.html`)
page.setDefaultTimeout(timeout)
const previewResult = await page.evaluate(async (job: JobPayload) => {
+1 -1
View File
@@ -67,7 +67,6 @@ const server = app.listen(port, host, async () => {
logger.info({ port }, '📡 Started Preview Service server, listening on {port}')
const gpuWithVulkanArgs = [
'--headless=new',
'--use-angle=vulkan',
'--enable-features=Vulkan',
'--disable-vulkan-surface',
@@ -80,6 +79,7 @@ const server = app.listen(port, host, async () => {
headless: !PREVIEWS_HEADED,
executablePath: CHROMIUM_EXECUTABLE_PATH,
userDataDir: USER_DATA_DIR,
// slowMo: 3000, // Use for debugging during development
// we trust the web content that is running, so can disable the sandbox
// disabling the sandbox allows us to run the docker image without linux kernel privileges
args: [