@@ -4,7 +4,6 @@ import readline from 'node:readline'
4
4
import colors from 'picocolors'
5
5
import type { RollupError } from 'rollup'
6
6
import type { ResolvedServerUrls } from './server'
7
- import { splitRE } from './utils'
8
7
9
8
export type LogType = 'error' | 'warn' | 'info'
10
9
export type LogLevel = LogType | 'silent'
@@ -64,8 +63,6 @@ function getTimeFormatter() {
64
63
return timeFormatter
65
64
}
66
65
67
- const MAX_LOG_CHAR = 5000
68
-
69
66
export function createLogger (
70
67
level : LogLevel = 'info' ,
71
68
options : LoggerOptions = { } ,
@@ -81,32 +78,17 @@ export function createLogger(
81
78
allowClearScreen && process . stdout . isTTY && ! process . env . CI
82
79
const clear = canClearScreen ? clearScreen : ( ) => { }
83
80
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 = { } ) {
100
82
if ( options . timestamp ) {
101
- const tag =
102
- type === 'info'
103
- ? colors . cyan ( colors . bold ( prefix ) )
104
- : type === 'warn'
105
- ? colors . yellow ( colors . bold ( prefix ) )
106
- : colors . red ( colors . bold ( prefix ) )
107
- return ` ${ colors . dim (
108
- getTimeFormatter ( ) . format ( new Date ( ) ) ,
109
- ) } ${ tag } ${ msg } `
83
+ let tag = ''
84
+ if ( type === 'info' ) {
85
+ tag = colors . cyan ( colors . bold ( prefix ) )
86
+ } else if ( type === 'warn' ) {
87
+ tag = colors . yellow ( colors . bold ( prefix ) )
88
+ } else {
89
+ tag = colors . red ( colors . bold ( prefix ) )
90
+ }
91
+ return ` ${ colors . dim ( getTimeFormatter ( ) . format ( new Date ( ) ) ) } ${ tag } ${ msg } `
110
92
} else {
111
93
return msg
112
94
}
0 commit comments