Skip to content

docs(en): merge webpack.js.org/master into webpack.js.org/cn @ bde990a7 #1696

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

Closed
wants to merge 12 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
docs(api): improve logging api (webpack#6413)
  • Loading branch information
chenxsan authored Sep 21, 2022
commit 1d4385900b8a99dd219636b509026c943a0880a3
7 changes: 7 additions & 0 deletions src/content/api/logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ module.exports = function (source) {
};
```

As you can see from the above `my-webpack-plugin.js` example, there're two types of logging methods,

1. `compilation.getLogger`
2. `compiler.getInfrastructureLogger`

It's advised to use `compilation.getLogger` when plugin/logging is related to the compilation, and they will be stored within the stats. For logging that happens outside the compilation cycle, use `compiler.getInfrastructureLogger` instead.

## Logger methods

- `logger.error(...)`: for error messages
Expand Down