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(api): improve logging api #6413

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Changes from all 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
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