Add --verbose 1 flag for mon
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ for (let i = 2; i < process.argv.length; i++)
|
||||
|
||||
if (!options.etcd_url)
|
||||
{
|
||||
console.error('USAGE: '+process.argv[0]+' '+process.argv[1]+' --etcd_url "http://127.0.0.1:2379,..." --etcd_prefix "/vitastor" --etcd_start_timeout 5');
|
||||
console.error('USAGE: '+process.argv[0]+' '+process.argv[1]+' --etcd_url "http://127.0.0.1:2379,..." --etcd_prefix "/vitastor" --etcd_start_timeout 5 [--verbose 1]');
|
||||
process.exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -221,6 +221,7 @@ class Mon
|
||||
url += '/v3';
|
||||
this.etcd_urls.push(scheme+'://'+url);
|
||||
}
|
||||
this.verbose = config.verbose || 0;
|
||||
this.etcd_prefix = config.etcd_prefix || '/vitastor';
|
||||
this.etcd_prefix = this.etcd_prefix.replace(/\/\/+/g, '/').replace(/^\/?(.*[^\/])\/?$/, '/$1');
|
||||
this.etcd_start_timeout = (config.etcd_start_timeout || 5) * 1000;
|
||||
@@ -345,7 +346,10 @@ class Mon
|
||||
else
|
||||
{
|
||||
let stats_changed = false, changed = false;
|
||||
console.log('Revision '+data.result.header.revision+' events: ');
|
||||
if (this.verbose)
|
||||
{
|
||||
console.log('Revision '+data.result.header.revision+' events: ');
|
||||
}
|
||||
this.etcd_watch_revision = BigInt(data.result.header.revision)+BigInt(1);
|
||||
for (const e of data.result.events)
|
||||
{
|
||||
@@ -359,7 +363,10 @@ class Mon
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
console.log(e);
|
||||
if (this.verbose)
|
||||
{
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
if (stats_changed)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user