Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// default level
log.level = 'info'
log.gauge = new Gauge(stream, {
enabled: false, // no progress bars unless asked
theme: {hasColor: log.useColor()},
template: [
{type: 'progressbar', length: 20},
{type: 'activityIndicator', kerning: 1, length: 1},
{type: 'section', default: ''},
':',
{type: 'logline', kerning: 1, default: ''}
]
})
log.tracker = new Progress.TrackerGroup()
// we track this separately as we may need to temporarily disable the
// display of the status bar for our own loggy purposes.
log.progressEnabled = log.gauge.isEnabled()
var unicodeEnabled
log.enableUnicode = function () {
unicodeEnabled = true
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
log.disableUnicode = function () {
unicodeEnabled = false
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
// default level
log.level = 'info'
log.gauge = new Gauge(stream, {
enabled: false, // no progress bars unless asked
theme: {hasColor: log.useColor()},
template: [
{type: 'progressbar', length: 20},
{type: 'activityIndicator', kerning: 1, length: 1},
{type: 'section', default: ''},
':',
{type: 'logline', kerning: 1, default: ''}
]
})
log.tracker = new Progress.TrackerGroup()
// we track this separately as we may need to temporarily disable the
// display of the status bar for our own loggy purposes.
log.progressEnabled = log.gauge.isEnabled()
var unicodeEnabled
log.enableUnicode = function () {
unicodeEnabled = true
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
log.disableUnicode = function () {
unicodeEnabled = false
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
// default level
log.level = 'info'
log.gauge = new Gauge(stream, {
theme: {hasColor: log.useColor()},
template: [
{type: 'progressbar', length: 20},
{type: 'activityIndicator', kerning: 1, length: 1},
{type: 'section', default: ''},
':',
{type: 'logline', kerning: 1, default: ''}
]
})
log.tracker = new Progress.TrackerGroup()
// no progress bars unless asked
log.progressEnabled = false
var unicodeEnabled
log.enableUnicode = function () {
unicodeEnabled = true
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
log.disableUnicode = function () {
unicodeEnabled = false
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
// default level
log.level = 'info'
log.gauge = new Gauge(stream, {
enabled: false, // no progress bars unless asked
theme: {hasColor: log.useColor()},
template: [
{type: 'progressbar', length: 20},
{type: 'activityIndicator', kerning: 1, length: 1},
{type: 'section', default: ''},
':',
{type: 'logline', kerning: 1, default: ''}
]
})
log.tracker = new Progress.TrackerGroup()
// we track this separately as we may need to temporarily disable the
// display of the status bar for our own loggy purposes.
log.progressEnabled = log.gauge.isEnabled()
var unicodeEnabled
log.enableUnicode = function () {
unicodeEnabled = true
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
log.disableUnicode = function () {
unicodeEnabled = false
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
// default level
log.level = 'info'
log.gauge = new Gauge(stream, {
theme: {hasColor: log.useColor()},
template: [
{type: 'progressbar', length: 20},
{type: 'activityIndicator', kerning: 1, length: 1},
{type: 'section', default: ''},
':',
{type: 'logline', kerning: 1, default: ''}
]
})
log.tracker = new Progress.TrackerGroup()
// no progress bars unless asked
log.progressEnabled = false
var unicodeEnabled
log.enableUnicode = function () {
unicodeEnabled = true
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
log.disableUnicode = function () {
unicodeEnabled = false
this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
}
// by default, let ansi decide based on tty-ness.
var colorEnabled = undefined
log.enableColor = function () {
colorEnabled = true
this.cursor.enabled = true
}
log.disableColor = function () {
colorEnabled = false
this.cursor.enabled = false
}
// default level
log.level = 'info'
log.gauge = new Gauge(log.cursor)
log.tracker = new Progress.TrackerGroup()
// no progress bars unless asked
log.progressEnabled = false
var gaugeTheme = undefined
log.enableUnicode = function () {
gaugeTheme = Gauge.unicode
log.gauge.setTheme(gaugeTheme)
}
log.disableUnicode = function () {
gaugeTheme = Gauge.ascii
log.gauge.setTheme(gaugeTheme)
}
import { Tracker, TrackerStream, TrackerGroup } from "are-we-there-yet";
const simple = new Tracker("simple");
simple.addListener("change", (name, completed, tracker) => {
console.log(`name: ${name}, completed: ${completed}`);
});
simple.addWork(10);
simple.completeWork(1);
console.log(simple.completed() < 1);
const group = new TrackerGroup("group");
group.addUnit(simple);
const subgroup = group.newGroup("subgroup");
console.log(group.completed());
const stream = new TrackerStream("stream", 100, { encoding: "utf8" });
subgroup.addUnit(stream);
stream.addListener("change", (name, completed, tracker) => {
console.log(`name: ${name}, completed: ${completed}`);
});
simple.finish();
console.log(group.debug());
function resetTracker () {
log.disableProgress()
log.tracker = new Progress.TrackerGroup()
log.enableProgress()
actions = []
}