MCPcopy
hub / github.com/webpack/webpack / apply

Method apply

test/helpers/LogTestPlugin.js:17–48  ·  view source on GitHub ↗

* @param {Compiler} compiler compiler

(compiler)

Source from the content-addressed store, hash-verified

15 * @param {Compiler} compiler compiler
16 */
17 apply(compiler) {
18 /**
19 * @param {ReturnType<Compilation["getLogger"]>} logger logger
20 */
21 const logSome = (logger) => {
22 logger.group("Group");
23 if (!this.noTraced) {
24 logger.error("Error");
25 logger.warn("Warning");
26 }
27 logger.info("Info");
28 logger.log("Log");
29 logger.debug("Debug");
30 logger.groupCollapsed("Collapsed group");
31 logger.log("Log inside collapsed group");
32 logger.group("Inner group");
33 logger.log("Inner inner message");
34 logger.groupEnd();
35 logger.groupEnd();
36 logger.log("Log");
37 logger.groupEnd();
38 logger.log("End");
39 };
40 logSome(compiler.getInfrastructureLogger("LogTestPlugin"));
41 compiler.hooks.compilation.tap("LogTestPlugin", (compilation) => {
42 const logger = compilation.getLogger("LogTestPlugin");
43 logSome(logger);
44
45 const otherLogger = compilation.getLogger("LogOtherTestPlugin");
46 otherLogger.debug("debug message only");
47 });
48 }
49};

Callers

nothing calls this directly

Calls 4

tapMethod · 0.80
debugMethod · 0.80
getLoggerMethod · 0.65

Tested by

no test coverage detected