MCPcopy
hub / github.com/webpack/webpack / getInfrastructureLogger

Method getInfrastructureLogger

lib/Compiler.js:394–468  ·  view source on GitHub ↗

* Gets infrastructure logger. * @param {string | (() => string)} name name of the logger, or function called once to get the logger name * @returns {Logger} a logger with that name

(name)

Source from the content-addressed store, hash-verified

392 * @returns {Logger} a logger with that name
393 */
394 getInfrastructureLogger(name) {
395 if (!name) {
396 throw new TypeError(
397 "Compiler.getInfrastructureLogger(name) called without a name"
398 );
399 }
400 return new Logger(
401 (type, args) => {
402 if (typeof name === "function") {
403 name = name();
404 if (!name) {
405 throw new TypeError(
406 "Compiler.getInfrastructureLogger(name) called with a function not returning a name"
407 );
408 }
409 }
410 if (
411 this.hooks.infrastructureLog.call(name, type, args) === undefined &&
412 this.infrastructureLogger !== undefined
413 ) {
414 this.infrastructureLogger(name, type, args);
415 }
416 },
417 (childName) => {
418 if (typeof name === "function") {
419 if (typeof childName === "function") {
420 return this.getInfrastructureLogger(() => {
421 if (typeof name === "function") {
422 name = name();
423 if (!name) {
424 throw new TypeError(
425 "Compiler.getInfrastructureLogger(name) called with a function not returning a name"
426 );
427 }
428 }
429 if (typeof childName === "function") {
430 childName = childName();
431 if (!childName) {
432 throw new TypeError(
433 "Logger.getChildLogger(name) called with a function not returning a name"
434 );
435 }
436 }
437 return `${name}/${childName}`;
438 });
439 }
440 return this.getInfrastructureLogger(() => {
441 if (typeof name === "function") {
442 name = name();
443 if (!name) {
444 throw new TypeError(
445 "Compiler.getInfrastructureLogger(name) called with a function not returning a name"
446 );
447 }
448 }
449 return `${name}/${childName}`;
450 });
451 }

Callers 9

processMethod · 0.45
applyMethod · 0.45
applyMethod · 0.45
processIdleTasksMethod · 0.45
applyMethod · 0.45
applyMethod · 0.45
applyMethod · 0.45

Calls 1

callMethod · 0.45

Tested by 2

applyMethod · 0.36