move setStatus from logger to event bus

This commit is contained in:
Iuri Matias 2018-02-27 15:49:21 -05:00
parent 66e9d6afa3
commit 445133cfdf
5 changed files with 5 additions and 6 deletions

View File

@ -80,7 +80,7 @@ class Engine {
pipelineService(_options) { pipelineService(_options) {
let self = this; let self = this;
this.logger.setStatus("Building Assets"); this.events.emit("status", "Building Assets");
let pipeline = new Pipeline({ let pipeline = new Pipeline({
buildDir: this.config.buildDir, buildDir: this.config.buildDir,
contractsFiles: this.config.contractsFiles, contractsFiles: this.config.contractsFiles,
@ -167,7 +167,7 @@ class Engine {
} }
fileWatchService(_options) { fileWatchService(_options) {
this.logger.setStatus("Watching for changes"); this.events.emit("status", "Watching for changes");
let watch = new Watch({logger: this.logger, events: this.events}); let watch = new Watch({logger: this.logger, events: this.events});
watch.start(); watch.start();
} }

View File

@ -5,7 +5,6 @@ class Logger {
this.logLevels = ['error', 'warn', 'info', 'debug', 'trace']; this.logLevels = ['error', 'warn', 'info', 'debug', 'trace'];
this.logLevel = options.logLevel || 'info'; this.logLevel = options.logLevel || 'info';
this.logFunction = options.logFunction || console.log; this.logFunction = options.logFunction || console.log;
this.setStatus = options.setStatus || console.log;
} }
} }

View File

@ -30,9 +30,9 @@ class Dashboard {
function startMonitor(callback) { function startMonitor(callback) {
monitor = new Monitor({env: self.env, console: console}); monitor = new Monitor({env: self.env, console: console});
self.logger.logFunction = monitor.logEntry; self.logger.logFunction = monitor.logEntry;
self.logger.setStatus = monitor.setStatus.bind(monitor);
self.events.on('contractsState', monitor.setContracts); self.events.on('contractsState', monitor.setContracts);
self.events.on('status', monitor.setStatus.bind(monitor));
self.logger.info('========================'.bold.green); self.logger.info('========================'.bold.green);
self.logger.info(('Welcome to Embark ' + self.version).yellow.bold); self.logger.info(('Welcome to Embark ' + self.version).yellow.bold);

View File

@ -129,7 +129,7 @@ class Embark {
engine.logger.info(err.stack); engine.logger.info(err.stack);
} else { } else {
engine.events.emit('firstDeploymentDone'); engine.events.emit('firstDeploymentDone');
engine.logger.setStatus("Ready".green); engine.events.emit("status", "Ready".green);
engine.logger.info("Looking for documentation? you can find it at ".cyan + "http://embark.readthedocs.io/".green.underline); engine.logger.info("Looking for documentation? you can find it at ".cyan + "http://embark.readthedocs.io/".green.underline);
engine.logger.info("Ready".underline); engine.logger.info("Ready".underline);

View File

@ -16,7 +16,7 @@ class WebServer {
this.host = options.host || this.webServerConfig.host; this.host = options.host || this.webServerConfig.host;
this.port = options.port || this.webServerConfig.port; this.port = options.port || this.webServerConfig.port;
this.logger.setStatus("Starting Server"); this.events.emit("status", "Starting Server");
this.server = new Server({logger: this.logger, host: this.host, port: this.port}); this.server = new Server({logger: this.logger, host: this.host, port: this.port});
this.setServiceCheck(); this.setServiceCheck();