forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogTestPlugin.js
34 lines (33 loc) · 933 Bytes
/
LogTestPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module.exports = class LogTestPlugin {
constructor(noTraced) {
this.noTraced = noTraced;
}
apply(compiler) {
const logSome = logger => {
logger.group("Group");
if (!this.noTraced) {
logger.error("Error");
logger.warn("Warning");
}
logger.info("Info");
logger.log("Log");
logger.debug("Debug");
logger.groupCollapsed("Collaped group");
logger.log("Log inside collapsed group");
logger.group("Inner group");
logger.groupEnd();
logger.log("Inner inner message");
logger.groupEnd();
logger.log("Log");
logger.groupEnd();
logger.log("End");
};
logSome(compiler.getInfrastructureLogger("LogTestPlugin"));
compiler.hooks.compilation.tap("LogTestPlugin", compilation => {
const logger = compilation.getLogger("LogTestPlugin");
logSome(logger);
const otherLogger = compilation.getLogger("LogOtherTestPlugin");
otherLogger.debug("debug message only");
});
}
};