mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-10 13:55:45 +00:00
fix: add back log command for modules (#1969)
This commit is contained in:
parent
af3c0f0bcb
commit
918a00c24c
@ -139,7 +139,7 @@ class Console {
|
||||
helpText.push(`${chalk.cyan(helpDescription.usage || matches.join("/"))} - ${helpDescription.description}`);
|
||||
});
|
||||
// Add end commands
|
||||
helpText.push(chalk.cyan("quit") + " - " + __("to immediatly exit (alias: exit)"),
|
||||
helpText.push(chalk.cyan("quit") + " - " + __("to immediately exit (alias: exit)"),
|
||||
"",
|
||||
__("The web3 object and the interfaces for the deployed contracts and their methods are also available"));
|
||||
return helpText.join("\n");
|
||||
|
@ -35,6 +35,14 @@ export class ProcessLauncher {
|
||||
this._subscribeToMessages();
|
||||
}
|
||||
|
||||
setSilent(value) {
|
||||
if (this.silent === value) {
|
||||
return;
|
||||
}
|
||||
this.silent = value;
|
||||
this.events.request('process:logs:register', {processName: this.name, eventName: `process:${this.name}:log`, silent: this.silent});
|
||||
}
|
||||
|
||||
_isDebug() {
|
||||
const argvString= process.execArgv.join();
|
||||
return argvString.includes('--debug') || argvString.includes('--inspect');
|
||||
|
@ -7,6 +7,7 @@ import BlockchainAPI from "./api";
|
||||
class Blockchain {
|
||||
|
||||
constructor(embark, options) {
|
||||
this.embark = embark;
|
||||
this.embarkConfig = embark.config.embarkConfig;
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
@ -16,6 +17,8 @@ class Blockchain {
|
||||
this.startedClient = null;
|
||||
this.plugins = options.plugins;
|
||||
|
||||
this.registerConsoleCommands();
|
||||
|
||||
embark.registerActionForEvent("pipeline:generateAll:before", this.addArtifactFile.bind(this));
|
||||
|
||||
this.blockchainNodes = {};
|
||||
@ -137,6 +140,20 @@ class Blockchain {
|
||||
});
|
||||
}
|
||||
|
||||
registerConsoleCommands() {
|
||||
this.embark.registerConsoleCommand({
|
||||
matches: ['log blockchain on'],
|
||||
process: (cmd, callback) => {
|
||||
this.events.request('logs:ethereum:enable', callback);
|
||||
}
|
||||
});
|
||||
this.embark.registerConsoleCommand({
|
||||
matches: ['log blockchain off'],
|
||||
process: (cmd, callback) => {
|
||||
this.events.request('logs:ethereum:disable', callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Blockchain;
|
||||
|
@ -60,12 +60,12 @@ export class BlockchainProcessLauncher {
|
||||
this.blockchainProcess.kill();
|
||||
});
|
||||
|
||||
this.events.on('logs:ethereum:enable', () => {
|
||||
this.blockchainProcess.silent = false;
|
||||
this.events.setCommandHandler('logs:ethereum:enable', () => {
|
||||
this.blockchainProcess.setSilent(false);
|
||||
});
|
||||
|
||||
this.events.on('logs:ethereum:disable', () => {
|
||||
this.blockchainProcess.silent = true;
|
||||
this.events.setCommandHandler('logs:ethereum:disable', () => {
|
||||
this.blockchainProcess.setSilent(true);
|
||||
});
|
||||
|
||||
this.events.on('exit', () => {
|
||||
|
@ -58,12 +58,13 @@ export class BlockchainProcessLauncher {
|
||||
this.blockchainProcess.kill();
|
||||
});
|
||||
|
||||
this.events.on('logs:ethereum:enable', () => {
|
||||
this.blockchainProcess.silent = false;
|
||||
|
||||
this.events.setCommandHandler('logs:ethereum:enable', () => {
|
||||
this.blockchainProcess.setSilent(false);
|
||||
});
|
||||
|
||||
this.events.on('logs:ethereum:disable', () => {
|
||||
this.blockchainProcess.silent = true;
|
||||
this.events.setCommandHandler('logs:ethereum:disable', () => {
|
||||
this.blockchainProcess.setSilent(true);
|
||||
});
|
||||
|
||||
this.events.on('exit', () => {
|
||||
|
@ -67,6 +67,19 @@ class IPFS {
|
||||
|
||||
upload_ipfs.deploy(readyCb);
|
||||
});
|
||||
|
||||
this.embark.registerConsoleCommand({
|
||||
matches: ['log ipfs on'],
|
||||
process: (cmd, callback) => {
|
||||
this.events.request('logs:ipfs:enable', callback);
|
||||
}
|
||||
});
|
||||
this.embark.registerConsoleCommand({
|
||||
matches: ['log ipfs off'],
|
||||
process: (cmd, callback) => {
|
||||
this.events.request('logs:ipfs:disable', callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async setupIpfsApi() {
|
||||
|
@ -160,12 +160,12 @@ class StorageProcessesLauncher {
|
||||
callback(error);
|
||||
});
|
||||
|
||||
self.events.on('logs:swarm:enable', () => {
|
||||
self.processes[storageName].silent = false;
|
||||
self.events.setCommandHandler('logs:ipfs:enable', () => {
|
||||
self.processes[storageName].setSilent(false);
|
||||
});
|
||||
|
||||
self.events.on('logs:swarm:disable', () => {
|
||||
self.processes[storageName].silent = true;
|
||||
self.events.setCommandHandler('logs:ipfs:disable', () => {
|
||||
self.processes[storageName].setSilent(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,19 @@ class Swarm {
|
||||
|
||||
upload_swarm.deploy(readyCb);
|
||||
});
|
||||
|
||||
this.embark.registerConsoleCommand({
|
||||
matches: ['log swarm on'],
|
||||
process: (cmd, callback) => {
|
||||
this.events.request('logs:swarm:enable', callback);
|
||||
}
|
||||
});
|
||||
this.embark.registerConsoleCommand({
|
||||
matches: ['log swarm off'],
|
||||
process: (cmd, callback) => {
|
||||
this.events.request('logs:swarm:disable', callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setupSwarmAPI() {
|
||||
|
@ -159,12 +159,12 @@ class StorageProcessesLauncher {
|
||||
callback(error);
|
||||
});
|
||||
|
||||
self.events.on('logs:swarm:enable', () => {
|
||||
self.processes[storageName].silent = false;
|
||||
self.events.setCommandHandler('logs:swarm:enable', () => {
|
||||
self.processes[storageName].setSilent(false);
|
||||
});
|
||||
|
||||
self.events.on('logs:swarm:disable', () => {
|
||||
self.processes[storageName].silent = true;
|
||||
self.events.setCommandHandler('logs:swarm:disable', () => {
|
||||
self.processes[storageName].setSilent(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user