Created
March 24, 2017 09:07
-
-
Save iGitScor/aaad382650d3671782e9d462853032db to your computer and use it in GitHub Desktop.
Webpack content replacer plugin - Log level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var winston = require('winston'): | |
class Logger { | |
static silent; // 0 | |
static logfile; // 1 | |
static strictError; // 2 | |
constructor(_loglevel) { | |
this.loglevel = _loglevel || Logger.silent; | |
this.outputWriter = new Winston(...params, this.getConfiguration()); | |
} | |
getConfiguration() { | |
var configuration = {}; | |
if (this.loglevel = 1) {...} | |
if (this.loglevel = 1) {...} | |
if (this.loglevel = 1) {...} | |
return configuration; | |
} | |
write(message) { | |
winston.log(message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Logger = require('lib/logger.js'); | |
class WebpackContentReplacerPLugin { | |
constructor(options) { | |
this.logger = new Logger(options.loglevel); | |
} | |
replace() { | |
this.logger.write('Replace content...'); | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment