Skip to content

Commit 1d43859

Browse files
authored
docs(api): improve logging api (webpack#6413)
1 parent a061579 commit 1d43859

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/content/api/logging.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ module.exports = function (source) {
5858
};
5959
```
6060

61+
As you can see from the above `my-webpack-plugin.js` example, there're two types of logging methods,
62+
63+
1. `compilation.getLogger`
64+
2. `compiler.getInfrastructureLogger`
65+
66+
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.
67+
6168
## Logger methods
6269

6370
- `logger.error(...)`: for error messages

0 commit comments

Comments
 (0)