website/docs/en/config/infrastructure-logging.mdx
import WebpackLicense from '@components/WebpackLicense';
<WebpackLicense from="https://webpack.js.org/configuration/infrastructureLogging/" />Options for infrastructure level logging. Generally used for logs unrelated to the Compilation.
booleanAppend lines to the output instead of updating existing output, useful for status messages. This option is used only when no custom console is provided.
export default {
infrastructureLogging: {
appendOnly: true,
level: 'verbose',
},
plugins: [
(compiler) => {
const logger = compiler.getInfrastructureLogger('MyPlugin');
logger.status('first output'); // this line won't be overridden with `appendOnly` enabled
logger.status('second output');
},
],
};
booleanEnable colorful output for infrastructure level logging. This option is used only when no custom console is provided.
export default {
infrastructureLogging: {
colors: true,
level: 'verbose',
},
plugins: [
(compiler) => {
const logger = compiler.getInfrastructureLogger('MyPlugin');
logger.log('this output will be colorful');
},
],
};
ConsoleConsoleCustomize the console used for infrastructure level logging.
export default {
infrastructureLogging: {
console: yourCustomConsole(),
},
};
boolean | RegExp | function(name) => boolean | [string, RegExp, function(name) => boolean]'false'Enable debug information of specified loggers such as plugins or loaders. Similar to stats.loggingDebug option but for infrastructure. Defaults to false.
export default {
infrastructureLogging: {
level: 'info',
debug: ['MyPlugin', /MyPlugin/, (name) => name.contains('MyPlugin')],
},
};
'none' | 'error' | 'warn' | 'info' | 'log' | 'verbose''info'Enable infrastructure logging output. Similar to stats.logging option but for infrastructure. Defaults to 'info'.
Possible values:
'none' - disable logging'error' - errors only'warn' - errors and warnings only'info' - errors, warnings, and info messages'log' - errors, warnings, info messages, log messages, groups, clears. Collapsed groups are displayed in a collapsed state.'verbose' - log everything except debug and trace. Collapsed groups are displayed in expanded state.export default {
infrastructureLogging: {
level: 'info',
},
};
NodeJS.WritableStreamprocess.stderrStream used for logging output. Defaults to process.stderr. This option is used only when no custom console is provided.
export default {
infrastructureLogging: {
stream: process.stderr,
},
};