Skip to content

Commit

Permalink
refactor: proxy environment logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Apr 12, 2024
1 parent 84299f3 commit 15cac1b
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion packages/vite/src/node/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,33 @@ export class Environment {
config: ResolvedConfig
options: ResolvedEnvironmentOptions
get logger(): Logger {
return this.config.logger
const logger = this.config.logger
const format = (msg: string) => {
return `(${this.name}) ${msg}`
}
return {
get hasWarned() {
return logger.hasWarned
},
info(msg, opts) {
return logger.info(format(msg), opts)
},
warn(msg, opts) {
return logger.warn(format(msg), opts)
},
warnOnce(msg, opts) {
return logger.warnOnce(format(msg), opts)
},
error(msg, opts) {
return logger.error(format(msg), opts)
},
clearScreen(type) {
return logger.clearScreen(type)
},
hasErrorLogged(error) {
return logger.hasErrorLogged(error)
},
}
}
constructor(
name: string,
Expand Down

0 comments on commit 15cac1b

Please sign in to comment.