Skip to content

Commit c0306c8

Browse files
committed
revert: fix(logger): truncate log over 5000 characters long (vitejs#16581)
1 parent 0cde495 commit c0306c8

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

packages/vite/src/node/logger.ts

+1-19
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import readline from 'node:readline'
44
import colors from 'picocolors'
55
import type { RollupError } from 'rollup'
66
import type { ResolvedServerUrls } from './server'
7-
import { splitRE } from './utils'
87

98
export type LogType = 'error' | 'warn' | 'info'
109
export type LogLevel = LogType | 'silent'
@@ -64,8 +63,6 @@ function getTimeFormatter() {
6463
return timeFormatter
6564
}
6665

67-
const MAX_LOG_CHAR = 5000
68-
6966
export function createLogger(
7067
level: LogLevel = 'info',
7168
options: LoggerOptions = {},
@@ -81,22 +78,7 @@ export function createLogger(
8178
allowClearScreen && process.stdout.isTTY && !process.env.CI
8279
const clear = canClearScreen ? clearScreen : () => {}
8380

84-
function preventOverflow(msg: string) {
85-
if (msg.length > MAX_LOG_CHAR) {
86-
const shorten = msg.slice(0, MAX_LOG_CHAR)
87-
const lines = msg.slice(MAX_LOG_CHAR).match(splitRE)?.length || 0
88-
89-
return `${shorten}\n... and ${lines} lines more`
90-
}
91-
return msg
92-
}
93-
94-
function format(
95-
type: LogType,
96-
rawMsg: string,
97-
options: LogErrorOptions = {},
98-
) {
99-
const msg = preventOverflow(rawMsg)
81+
function format(type: LogType, msg: string, options: LogErrorOptions = {}) {
10082
if (options.timestamp) {
10183
const tag =
10284
type === 'info'

0 commit comments

Comments
 (0)