修正Logger类中的日志输出,将console.log替换为console.error,以确保错误信息的正确输出。

This commit is contained in:
sean
2025-06-14 13:39:48 +08:00
parent 2ff9cdc4bd
commit 0d4c80784f

View File

@ -15,7 +15,7 @@ class Logger {
*/ */
info (message, ...args) { info (message, ...args) {
if (this.silent) return if (this.silent) return
console.log(chalk.blue(''), message, ...args) console.error(chalk.blue(''), message, ...args)
} }
/** /**
@ -23,7 +23,7 @@ class Logger {
*/ */
success (message, ...args) { success (message, ...args) {
if (this.silent) return if (this.silent) return
console.log(chalk.green('✅'), message, ...args) console.error(chalk.green('✅'), message, ...args)
} }
/** /**
@ -31,7 +31,7 @@ class Logger {
*/ */
warn (message, ...args) { warn (message, ...args) {
if (this.silent) return if (this.silent) return
console.log(chalk.yellow('⚠️'), chalk.yellow(message), ...args) console.error(chalk.yellow('⚠️'), chalk.yellow(message), ...args)
} }
/** /**
@ -47,7 +47,7 @@ class Logger {
*/ */
debug (message, ...args) { debug (message, ...args) {
if (this.silent || !process.env.DEBUG) return if (this.silent || !process.env.DEBUG) return
console.log(chalk.gray('🐛'), chalk.gray(message), ...args) console.error(chalk.gray('🐛'), chalk.gray(message), ...args)
} }
/** /**
@ -55,7 +55,7 @@ class Logger {
*/ */
step (message, ...args) { step (message, ...args) {
if (this.silent) return if (this.silent) return
console.log(chalk.cyan('▶️'), message, ...args) console.error(chalk.cyan('▶️'), message, ...args)
} }
/** /**
@ -63,7 +63,7 @@ class Logger {
*/ */
log (message, ...args) { log (message, ...args) {
if (this.silent) return if (this.silent) return
console.log(message, ...args) console.error(message, ...args)
} }
/** /**
@ -71,7 +71,7 @@ class Logger {
*/ */
newLine () { newLine () {
if (this.silent) return if (this.silent) return
console.log('') console.error('')
} }
/** /**
@ -79,7 +79,7 @@ class Logger {
*/ */
separator (char = '=', length = 80) { separator (char = '=', length = 80) {
if (this.silent) return if (this.silent) return
console.log(chalk.gray(char.repeat(length))) console.error(chalk.gray(char.repeat(length)))
} }
} }