Skip to content

Commit

Permalink
feat: allow custom console in createLogger (vitejs#18379)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Oct 26, 2024
1 parent 2ebe4b4 commit 0c497d9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vite/src/node/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface LoggerOptions {
prefix?: string
allowClearScreen?: boolean
customLogger?: Logger
console?: Console
}

// Only initialize the timeFormatter when the timestamp option is used, and
Expand All @@ -73,7 +74,11 @@ export function createLogger(
}

const loggedErrors = new WeakSet<Error | RollupError>()
const { prefix = '[vite]', allowClearScreen = true } = options
const {
prefix = '[vite]',
allowClearScreen = true,
console = globalThis.console,
} = options
const thresh = LogLevels[level]
const canClearScreen =
allowClearScreen && process.stdout.isTTY && !process.env.CI
Expand Down

0 comments on commit 0c497d9

Please sign in to comment.