Skip to content

Commit d985a5e

Browse files
committed
Fixing --logLevel option for embark run
Intercepting logs for embark run and including logLevel for displayed logs.
1 parent ad13680 commit d985a5e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

lib/cmd.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class Cmd {
102102
.option('--nodashboard', 'simple mode, disables the dashboard')
103103
.option('--no-color', 'no colors in case it\'s needed for compatbility purposes')
104104
.option('--logfile [logfile]', 'filename to output logs (default: none)')
105+
.option('--logLevel [logLevel]', 'level of logging to display ["error", "warn", "info", "debug", "trace"] (default: debug)')
105106
.description('run dapp (default: development)')
106107
.action(function (env, options) {
107108
embark.run({
@@ -110,7 +111,8 @@ class Cmd {
110111
serverHost: options.host,
111112
runWebserver: !options.noserver,
112113
useDashboard: !options.nodashboard,
113-
logfile: options.logfile
114+
logfile: options.logfile,
115+
logLevel: options.logLevel
114116
});
115117
});
116118
}

lib/core/engine.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ class Engine {
1717
this.interceptLogs = options.interceptLogs;
1818
this.version = options.version;
1919
this.logfile = options.logfile;
20+
this.logLevel = options.logLevel;
2021
}
2122

2223
init(_options) {
2324
let self = this;
2425
let options = _options || {};
2526
this.events = new Events();
26-
this.logger = options.logger || new Logger({logLevel: options.logLevel || 'debug', events: this.events, logfile: this.logfile});
27+
this.logger = options.logger || new Logger({logLevel: options.logLevel || this.logLevel || 'debug', events: this.events, logfile: this.logfile});
2728
this.config = new Config({env: this.env, logger: this.logger, events: this.events});
2829
this.config.loadConfigFiles({embarkConfig: this.embarkConfig, interceptLogs: this.interceptLogs});
2930
this.plugins = this.config.plugins;

lib/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ class Embark {
6161
env: options.env,
6262
version: this.version,
6363
embarkConfig: options.embarkConfig || 'embark.json',
64-
logfile: options.logfile
64+
logfile: options.logfile,
65+
logLevel: options.logLevel,
66+
interceptLogs: true
6567
});
6668
engine.init();
6769

0 commit comments

Comments
 (0)