Merge pull request #479 from embark-framework/features/storage-trace-logging-updates

Improve storage logging (during --loglevel trace)
This commit is contained in:
Iuri Matias 2018-06-05 08:48:00 -04:00 committed by GitHub
commit 1380355d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -48,8 +48,8 @@ class IPFS {
});
self.events.request("services:register", 'IPFS', function (cb) {
self.logger.trace("Checking IPFS version...");
let url = (self.protocol || 'http') + '://' + self.host + ':' + self.port + '/api/v0/version';
self.logger.trace(`Checking IPFS version on ${url}...`);
if(self.protocol !== 'https'){
utils.httpGetJson(url, versionCb);
} else {
@ -61,8 +61,10 @@ class IPFS {
return cb({name: "IPFS ", status: 'off'});
}
if (body.Version) {
self.logger.trace("Swarm available");
return cb({name: ("IPFS " + body.Version), status: 'on'});
}
self.logger.trace("Swarm available");
return cb({name: "IPFS ", status: 'on'});
}
});

View File

@ -54,8 +54,9 @@ class Swarm {
});
self.events.request("services:register", 'Swarm', function(cb){
self.logger.trace("Checking Swarm availability...");
self.logger.trace(`Checking Swarm availability on ${self.bzz.currentProvider}...`);
self.bzz.isAvailable().then(result => {
self.logger.trace("Swarm " + (result ? '':'un') + "available");
return cb({name: "Swarm ", status: result ? 'on':'off'});
}).catch(err => {
self.logger.trace("Check Swarm availability error: " + err);

View File

@ -51,8 +51,9 @@ class IPFSProcess extends ProcessWrapper {
self.readyCalled = true;
// update IPFS cors before spawning a daemon (muhaha)
console.log(`RUNNING IPFS CORS UPDATE COMMAND: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\\"${self.cors.join('\\", \\"')}\\"]"`);
child_process.exec(`ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\\"${self.cors.join('\\", \\"')}\\"]"`, {silent: true}, (err, stdout, _stderr) => {
let ipfsCorsCmd = `ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\\"${self.cors.join('\\", \\"')}\\"]"`;
console.trace(`Updating IPFS CORS using command: ${ipfsCorsCmd}`);
child_process.exec(ipfsCorsCmd, {silent: true}, (err, stdout, _stderr) => {
if(err){
err = err.toString();
console.error('IPFS CORS update error: ', err);