MCPcopy
hub / github.com/vercel/next.js / consoleHandler

Function consoleHandler

turbopack/packages/devlow-bench/src/browser.ts:57–82  ·  view source on GitHub ↗
(message: ConsoleMessage)

Source from the content-addressed store, hash-verified

55 let warningCount = 0
56 let logCount = 0
57 const consoleHandler = (message: ConsoleMessage) => {
58 const type = message.type()
59 if (type === 'error') {
60 errorCount++
61 } else if (type === 'warning') {
62 warningCount++
63 } else {
64 logCount++
65 }
66 if (browserOutput) {
67 activePromises.push(
68 (async () => {
69 const args = []
70 try {
71 const text = message.text()
72 for (const arg of message.args()) {
73 args.push(await arg.jsonValue())
74 }
75 console.log(`[${type}] ${text}`, ...args)
76 } catch {
77 // Ignore
78 }
79 })()
80 )
81 }
82 }
83 let uncaughtCount = 0
84 const exceptionHandler = (error: Error) => {
85 uncaughtCount++

Callers

nothing calls this directly

Calls 5

pushMethod · 0.65
textMethod · 0.65
typeMethod · 0.45
argsMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected