source: trip-planner-front/node_modules/webpack/lib/logging/runtime.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[6a3a178]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const SyncBailHook = require("tapable/lib/SyncBailHook");
9const { Logger } = require("./Logger");
10const createConsoleLogger = require("./createConsoleLogger");
11
12/** @type {createConsoleLogger.LoggerOptions} */
13let currentDefaultLoggerOptions = {
14 level: "info",
15 debug: false,
16 console
17};
18let currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
19
20/**
21 * @param {string} name name of the logger
22 * @returns {Logger} a logger
23 */
24exports.getLogger = name => {
25 return new Logger(
26 (type, args) => {
27 if (exports.hooks.log.call(name, type, args) === undefined) {
28 currentDefaultLogger(name, type, args);
29 }
30 },
31 childName => exports.getLogger(`${name}/${childName}`)
32 );
33};
34
35/**
36 * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options
37 * @returns {void}
38 */
39exports.configureDefaultLogger = options => {
40 Object.assign(currentDefaultLoggerOptions, options);
41 currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
42};
43
44exports.hooks = {
45 log: new SyncBailHook(["origin", "type", "args"])
46};
Note: See TracBrowser for help on using the repository browser.