source: imaps-frontend/node_modules/webpack/lib/logging/runtime.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[79a0317]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");
9const { Logger } = require("./Logger");
10const createConsoleLogger = require("./createConsoleLogger");
11
12/** @type {createConsoleLogger.LoggerOptions} */
13const 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 */
24module.exports.getLogger = name =>
25 new Logger(
26 (type, args) => {
27 if (module.exports.hooks.log.call(name, type, args) === undefined) {
28 currentDefaultLogger(name, type, args);
29 }
30 },
31 childName => module.exports.getLogger(`${name}/${childName}`)
32 );
33
34/**
35 * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options
36 * @returns {void}
37 */
38module.exports.configureDefaultLogger = options => {
39 Object.assign(currentDefaultLoggerOptions, options);
40 currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
41};
42
43module.exports.hooks = {
44 log: new SyncBailHook(["origin", "type", "args"])
45};
Note: See TracBrowser for help on using the repository browser.