Skip to content

Commit a338bea

Browse files
committed
add default value for LogOptions to createLogger
1 parent c18ce86 commit a338bea

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/vite/src/node/logger.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export interface LoggerOptions {
5151
allowClearScreen?: boolean
5252
customLogger?: Logger
5353
console?: Console
54+
defaultLogOptions?: LogOptions
5455
}
5556

5657
// Only initialize the timeFormatter when the timestamp option is used, and
@@ -78,13 +79,15 @@ export function createLogger(
7879
prefix = '[vite]',
7980
allowClearScreen = true,
8081
console = globalThis.console,
82+
defaultLogOptions = {}
8183
} = options
8284
const thresh = LogLevels[level]
8385
const canClearScreen =
8486
allowClearScreen && process.stdout.isTTY && !process.env.CI
8587
const clear = canClearScreen ? clearScreen : () => {}
8688

8789
function format(type: LogType, msg: string, options: LogErrorOptions = {}) {
90+
options = Object.assign(defaultLogOptions, options)
8891
if (options.timestamp) {
8992
let tag = ''
9093
if (type === 'info') {

0 commit comments

Comments
 (0)