Skip to content

Commit c614132

Browse files
EugeneHlushkomontogeek
authored andcommitted
docs(api) document runtime logger usage (webpack#3241)
* docs(api) document runtime logger usage * docs(api) runtime logger list format
1 parent fe32213 commit c614132

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/content/api/logging.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,22 @@ W> __Avoid noise in the log!__ Keep in mind that multiple plugins and loaders ar
3737
- `logger.groupEnd()`: to end a logging group
3838
- `logger.groupCollapsed(...)`: to group messages together. Displayed collapsed like `logger.log`. Displayed expanded when logging level is set to `'verbose'` or `'debug'`.
3939
- `logger.clear()`: to print a horizontal line. Displayed like `logger.log`
40-
- `logger.profile(...)`, `logger.profileEnd(...)`: to capture a profile. Delegated to `console.profile` when supported
40+
- `logger.profile(...)`, `logger.profileEnd(...)`: to capture a profile. Delegated to `console.profile` when supported
41+
42+
## Runtime Logger API
43+
44+
Runtime logger API is only intended to be used as a development tool, it is not intended to be included in [production mode](/configuration/mode/#mode-production).
45+
46+
- `const logging = require('webpack/logging/runtime')`: to use the logger in runtime, require it directly from webpack
47+
- `logging.getLogger('name')`: to get individual logger by name
48+
- `logging.configureDefaultLogger(...)`: to override the default logger.
49+
50+
```javascript
51+
const logging = require('webpack/logging/runtime');
52+
logging.configureDefaultLogger({
53+
level: 'log',
54+
debug: /something/
55+
});
56+
```
57+
58+
- `logging.hooks.log`: to apply Plugins to the runtime logger

0 commit comments

Comments
 (0)