Fully implement the logs and bars switch
This commit is contained in:
@@ -2,23 +2,28 @@ const cliProgress = require("cli-progress");
|
||||
const { Metric } = require("./metrics");
|
||||
|
||||
class MetricManager {
|
||||
constructor() {
|
||||
this.metricBufferSize = 1000;
|
||||
this.multibar = new cliProgress.MultiBar(
|
||||
{
|
||||
clearOnComplete: false,
|
||||
barCompleteChar: "\u2588",
|
||||
barIncompleteChar: "\u2591",
|
||||
format: " {bar} | {name} | {value}/{total}",
|
||||
},
|
||||
cliProgress.Presets.shades_grey
|
||||
);
|
||||
setInterval(() => this.multibar.update(), 100);
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
if (options.bars) {
|
||||
this.metricBufferSize = 1000;
|
||||
this.multibar = new cliProgress.MultiBar(
|
||||
{
|
||||
clearOnComplete: false,
|
||||
barCompleteChar: "\u2588",
|
||||
barIncompleteChar: "\u2591",
|
||||
format: " {bar} | {name} | {value}/{total}",
|
||||
},
|
||||
cliProgress.Presets.shades_grey
|
||||
);
|
||||
setInterval(() => this.multibar.update(), 100);
|
||||
}
|
||||
}
|
||||
|
||||
AddMetrics(name, refresh = true) {
|
||||
const metric = new Metric(name, this.multibar, this.metricBufferSize, refresh);
|
||||
return metric;
|
||||
if (this.options.bars) {
|
||||
const metric = new Metric(name, this.multibar, this.metricBufferSize, refresh);
|
||||
return metric;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user