Sha256: ff1c3b23c206deb261f8295e1f8dbd8cec9053982655e53aab68f6c85e123eba

Contents?: true

Size: 1002 Bytes

Versions: 26

Compression:

Stored size: 1002 Bytes

Contents

const SyncBailHook = require("tapable/lib/SyncBailHook");
const { Logger } = require("./Logger");
const createConsoleLogger = require("./createConsoleLogger");

/** @type {createConsoleLogger.LoggerOptions} */
let currentDefaultLoggerOptions = {
	level: "info",
	debug: false,
	console
};
let currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);

/**
 * @param {string} name name of the logger
 * @returns {Logger} a logger
 */
exports.getLogger = name => {
	return new Logger((type, args) => {
		if (exports.hooks.log.call(name, type, args) === undefined) {
			currentDefaultLogger(name, type, args);
		}
	});
};

/**
 * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options
 * @returns {void}
 */
exports.configureDefaultLogger = options => {
	Object.assign(currentDefaultLoggerOptions, options);
	currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
};

exports.hooks = {
	log: new SyncBailHook(["origin", "type", "args"])
};

Version data entries

26 entries across 25 versions & 8 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.18.0 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.18.2 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.16.1 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.15.2 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.18.4 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.18.1 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.14.0 test/dummy/node_modules/webpack/lib/logging/runtime.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/webpack/lib/logging/runtime.js
tang-0.2.1 spec/tang_app/node_modules/webpack/lib/logging/runtime.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/webpack/lib/logging/runtime.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/webpack/lib/logging/runtime.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/webpack/lib/logging/runtime.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/webpack/lib/logging/runtime.js
tang-0.2.0 spec/tang_app/node_modules/webpack/lib/logging/runtime.js
tang-0.1.0 spec/tang_app/node_modules/webpack/lib/logging/runtime.js
tang-0.0.9 spec/tang_app/node_modules/webpack/lib/logging/runtime.js
enju_library-0.3.8 spec/dummy/node_modules/webpack/lib/logging/runtime.js
jester-data-8.0.0 node_modules/webpack/lib/logging/runtime.js