Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Jun 18, 2020
1 parent d277ab0 commit fc078a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/BundleAnalyzerPlugin.js
Expand Up @@ -35,8 +35,10 @@ class BundleAnalyzerPlugin {
this.compiler = compiler;

// Respect default logging level from webpack
const defaultLoggerLevel = compiler.options.infrastructureLogging && compiler.options.infrastructureLogging.level ? compiler.options.infrastructureLogging.level : this.opts.logLevel;
this.logger = compiler.getInfrastructureLogger ? compiler.getInfrastructureLogger('webpack-bundle-analyzer') : new Logger(defaultLoggerLevel);
const defaultLoggerLevel = compiler.options.infrastructureLogging && compiler.options.infrastructureLogging.level ?
compiler.options.infrastructureLogging.level : this.opts.logLevel;
this.logger = compiler.getInfrastructureLogger ?
compiler.getInfrastructureLogger('webpack-bundle-analyzer') : new Logger(defaultLoggerLevel);

const done = (stats, callback) => {
callback = callback || (() => {});
Expand Down
6 changes: 3 additions & 3 deletions src/Logger.js
Expand Up @@ -23,7 +23,7 @@ const LEVEL_TO_CONSOLE_METHOD = new Map([
['warn', 'log']
]);

const webpackLogger = require('webpack/lib/logging/runtime')
const webpackLogger = require('webpack/lib/logging/runtime');

if (webpackLogger.getLogger) LEVELS.push(...loggerMethods);

Expand All @@ -50,7 +50,7 @@ class Logger {

_log(level, ...args) {
if (webpackLogger.getLogger) {
webpackLogger.getLogger('webpack-bundle-analyzer')[level](...args)
webpackLogger.getLogger('webpack-bundle-analyzer')[level](...args);
} else {
console[LEVEL_TO_CONSOLE_METHOD.get(level) || level](...args);
}
Expand All @@ -66,4 +66,4 @@ LEVELS.forEach(level => {
};
});

module.exports = Logger
module.exports = Logger;

0 comments on commit fc078a9

Please sign in to comment.