Improve storage logging (during --loglevel trace)

Includes IPFS command run 
Includes response from IPFS/Swarm service checks
Includes url being checked during IPFS/Swarm service checks.
This commit is contained in:
Eric Mastro 2018-06-05 11:39:28 +10:00
parent a866cd9e2b
commit c45fdb12df
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);