Skip to content

Commit

Permalink
docs(api): improve logging api (#6413)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxsan authored Sep 21, 2022
1 parent a061579 commit 1d43859
Showing 1 changed file with 7 additions and 0 deletions.
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

1 comment on commit 1d43859

@vercel
Copy link

@vercel vercel bot commented on 1d43859 Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.