Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added custom logger info #10108

Merged
merged 5 commits into from
Feb 24, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ export default defineConfig(async ({ command, mode }) => {
})
```

## Custom Logger

Vite provides a `createLogger` function which you can filter out warnings or provide a custom message for your errors.

```js
import { createLogger, defineConfig } from 'vite'

const logger = createLogger()
const originalWarning = logger.warn
logger.warn = (msg, options) => {
if (msg.includes('vite:css') && msg.includes(' is empty')) return
originalWarning(msg, options)
}

export default defineConfig({
customLogger: logger
})
```

## Environment Variables

Environmental Variables can be obtained from `process.env` as usual.
Expand Down