Skip to content

Commit 9797792

Browse files
EugeneHlushkomontogeek
authored andcommitted
docs(config) document logging feature (#3208)
* docs(config) document logging feature * docs(config) document logging feature: lint
1 parent d33cd87 commit 9797792

File tree

2 files changed

+101
-18
lines changed

2 files changed

+101
-18
lines changed

src/content/configuration/other-options.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,57 @@ module.exports = {
184184
name: 'admin-app'
185185
};
186186
```
187+
188+
### infrastructureLogging
189+
190+
Options for infrastructure level logging.
191+
192+
`object: {}`
193+
194+
#### infrastructureLogging.level
195+
196+
`string`
197+
198+
Enable infrastructure logging output. Similar to [`stats.logging`](/configuration/stats/#stats) option but for infrastructure. No default value is given.
199+
200+
Possible values:
201+
202+
- `'none'` - disable logging
203+
- `'error'` - errors only
204+
- `'warn'` - errors and warnings only
205+
- `'info'` - errors, warnings, and info messages
206+
- `'log'` - errors, warnings, info messages, log messages, groups, clears. Collapsed groups are displayed in a collapsed state.
207+
- `'verbose'` - log everything except debug and trace. Collapsed groups are displayed in expanded state.
208+
209+
__webpack.config.js__
210+
211+
```javascript
212+
module.exports = {
213+
//...
214+
infrastructureLogging: {
215+
level: 'info'
216+
}
217+
};
218+
```
219+
220+
#### infrastructureLogging.debug
221+
222+
`string` `RegExp` `(name) => boolean` `[string, RegExp, (name) => boolean]`
223+
224+
Enable debug information of specified loggers such as plugins or loaders. Similar to [`stats.loggingDebug`](/configuration/stats/#stats) option but for infrastructure. No default value is given.
225+
226+
__webpack.config.js__
227+
228+
```javascript
229+
module.exports = {
230+
//...
231+
infrastructureLogging: {
232+
level: 'info',
233+
debug: [
234+
'MyPlugin',
235+
/MyPlugin/,
236+
(name) => name.contains('MyPlugin')
237+
]
238+
}
239+
};
240+
```

src/content/configuration/stats.md

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ module.exports = {
3535

3636
| Preset | Alternative | Description |
3737
|---------------------|-------------|---------------------------------------------------|
38-
| `"errors-only"` | _none_ | Only output when errors happen |
39-
| `"errors-warnings"` | _none_ | Only output errors and warnings happen |
40-
| `"minimal"` | _none_ | Only output when errors or new compilation happen |
41-
| `"none"` | `false` | Output nothing |
42-
| `"normal"` | `true` | Standard output |
43-
| `"verbose"` | _none_ | Output everything |
38+
| `'errors-only'` | _none_ | Only output when errors happen |
39+
| `'errors-warnings'` | _none_ | Only output errors and warnings happen |
40+
| `'minimal'` | _none_ | Only output when errors or new compilation happen |
41+
| `'none'` | `false` | Output nothing |
42+
| `'normal'` | `true` | Standard output |
43+
| `'verbose'` | _none_ | Output everything |
4444

4545
For more granular control, it is possible to specify exactly what information you want. Please note that all of the options in this object are optional.
4646

@@ -50,7 +50,8 @@ For more granular control, it is possible to specify exactly what information yo
5050
module.exports = {
5151
//...
5252
stats: {
53-
// fallback value for stats options when an option is not defined (has precedence over local webpack defaults)
53+
// fallback value for stats options when an option is not defined
54+
// (has precedence over local webpack defaults)
5455
all: undefined,
5556

5657
// Add asset Information
@@ -60,7 +61,7 @@ module.exports = {
6061
// You can reverse the sort with `!field`.
6162
// Some possible values: 'id' (default), 'name', 'size', 'chunks', 'failed', 'issuer'
6263
// For a complete list of fields see the bottom of the page
63-
assetsSort: "field",
64+
assetsSort: 'field',
6465

6566
// Add build date and time information
6667
builtAt: true,
@@ -90,10 +91,10 @@ module.exports = {
9091
// You can reverse the sort with `!field`. Default is `id`.
9192
// Some other possible values: 'name', 'size', 'chunks', 'failed', 'issuer'
9293
// For a complete list of fields see the bottom of the page
93-
chunksSort: "field",
94+
chunksSort: 'field',
9495

9596
// Context directory for request shortening
96-
context: "../src/",
97+
context: '../src/',
9798

9899
// `webpack --colors` equivalent
99100
colors: false,
@@ -116,22 +117,48 @@ module.exports = {
116117
// Exclude assets from being displayed in stats
117118
// This can be done with a String, a RegExp, a Function getting the assets name
118119
// and returning a boolean or an Array of the above.
119-
excludeAssets: "filter" | /filter/ | (assetName) => true | false |
120-
["filter"] | [/filter/] | [(assetName) => true|false],
120+
// Possible values: String | RegExp | (assetName) => boolean | [String, RegExp, (assetName) => boolean]
121+
// Example values: 'filter' | /filter/ | ['filter', /filter/] | (assetName) => assetName.contains('moduleA')
122+
excludeAssets: [],
121123

122124
// Exclude modules from being displayed in stats
123125
// This can be done with a String, a RegExp, a Function getting the modules source
124126
// and returning a boolean or an Array of the above.
125-
excludeModules: "filter" | /filter/ | (moduleSource) => true | false |
126-
["filter"] | [/filter/] | [(moduleSource) => true|false],
127+
// Possible values: String | RegExp | (moduleSource) => boolean | [String, RegExp, (moduleSource) => boolean]
128+
// Example values: 'filter' | /filter/ | ['filter', /filter/] | (moduleSource) => true
129+
excludeModules: exclude || [],
127130

128131
// See excludeModules
129-
exclude: "filter" | /filter/ | (moduleSource) => true | false |
130-
["filter"] | [/filter/] | [(moduleSource) => true|false],
132+
// Possible values: String | RegExp | (moduleSource) => boolean | [String, RegExp, (moduleSource) => boolean]
133+
// Example values: 'filter' | /filter/ | ['filter', /filter/] | (moduleSource) => true
134+
exclude: excludeModules || [],
131135

132136
// Add the hash of the compilation
133137
hash: true,
134138

139+
// Add logging output
140+
// Possible values: 'none', 'error', 'warn', 'info', 'log', 'verbose', true, false
141+
// 'none', false - disable logging
142+
// 'error' - errors only
143+
// 'warn' - errors and warnings only
144+
// 'info' - errors, warnings, and info messages
145+
// 'log', true - errors, warnings, info messages, log messages, groups, clears.
146+
// Collapsed groups are displayed in a collapsed state.
147+
// 'verbose' - log everything except debug and trace.
148+
// Collapsed groups are displayed in expanded state.
149+
logging: 'info',
150+
151+
// Include debug information of specified loggers such as plugins or loaders.
152+
// Provide an array of filters to match plugins or loaders.
153+
// Filters can be Strings, RegExps or Functions.
154+
// when stats.logging is false, stats.loggingDebug option is ignored.
155+
// Possible values: String | RegExp | (warning) => boolean | [String, RegExp, (name) => boolean]
156+
// Example values: 'MyPlugin' | /MyPlugin/ | ['MyPlugin', /MyPlugin/] | (name) => name.contains('MyPlugin')
157+
loggingDebug: [],
158+
159+
// Enable stack traces in logging output for errors, warnings and traces.
160+
loggingTrace: true,
161+
135162
// Set the maximum number of modules to be shown
136163
maxModules: 15,
137164

@@ -142,7 +169,7 @@ module.exports = {
142169
// You can reverse the sort with `!field`. Default is `id`.
143170
// Some other possible values: 'name', 'size', 'chunks', 'failed', 'issuer'
144171
// For a complete list of fields see the bottom of the page
145-
modulesSort: "field",
172+
modulesSort: 'field',
146173

147174
// Show dependencies and origin of warnings/errors (since webpack 2.5.0)
148175
moduleTrace: true,
@@ -180,7 +207,9 @@ module.exports = {
180207
// Filter warnings to be shown (since webpack 2.4.0),
181208
// can be a String, Regexp, a function getting the warning and returning a boolean
182209
// or an Array of a combination of the above. First match wins.
183-
warningsFilter: "filter" | /filter/ | ["filter", /filter/] | (warning) => true|false
210+
// Possible values: String | RegExp | (warning) => boolean | [String, RegExp, (warning) => boolean]
211+
// Example values: 'filter' | /filter/ | ['filter', /filter/] | (warning) => true
212+
warningsFilter: null
184213
}
185214
}
186215
```

0 commit comments

Comments
 (0)