log.js
1.15 KB
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
35
36
37
38
39
40
import logger from "../modules/logger/index.js";
var name = "webpack-dev-server"; // default level is set on the client side, so it does not need
// to be set by the CLI or API
var defaultLevel = "info"; // options new options, merge with old options
/**
* @param {false | true | "none" | "error" | "warn" | "info" | "log" | "verbose"} level
* @returns {void}
*/
function setLogLevel(level) {
logger.configureDefaultLogger({
level: level
});
}
setLogLevel(defaultLevel);
var log = logger.getLogger(name);
var logEnabledFeatures = function logEnabledFeatures(features) {
var enabledFeatures = Object.keys(features);
if (!features || enabledFeatures.length === 0) {
return;
}
var logString = "Server started:"; // Server started: Hot Module Replacement enabled, Live Reloading enabled, Overlay disabled.
for (var i = 0; i < enabledFeatures.length; i++) {
var key = enabledFeatures[i];
logString += " ".concat(key, " ").concat(features[key] ? "enabled" : "disabled", ",");
} // replace last comma with a period
logString = logString.slice(0, -1).concat(".");
log.info(logString);
};
export { log, logEnabledFeatures, setLogLevel };