More cleanup
This commit is contained in:
@ -2,29 +2,28 @@ export class Logger {
|
||||
historyLen = 19;
|
||||
history = [];
|
||||
|
||||
/**
|
||||
* Create a nicer log with a banner.
|
||||
* @param ns {NS} - BitBurner API
|
||||
* @param lineFns {Function[]} - Functions to generate a line (Seperated by a linebreak)
|
||||
*/
|
||||
/**
|
||||
* Create a nicer log with a banner.
|
||||
* @param ns {NS} - BitBurner API
|
||||
* @param lineFns {Function[]} - Functions to generate a line (Seperated by a linebreak)
|
||||
*/
|
||||
constructor(ns, lineFns = []) {
|
||||
this.ns = ns;
|
||||
this.fns = lineFns;
|
||||
this.historyLen -= fns.length * 2;
|
||||
this.historyLen -= lineFns.length * 2;
|
||||
this.history = Array(this.historyLen).fill('');
|
||||
this.log();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a linebreak
|
||||
*/
|
||||
/**
|
||||
* Add a linebreak
|
||||
*/
|
||||
lineBreak() {
|
||||
this.ns.print('===================================================');
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the header using the provided functions
|
||||
*/
|
||||
/**
|
||||
* Print the header using the provided functions
|
||||
*/
|
||||
header() {
|
||||
this.lineBreak();
|
||||
this.fns.forEach(fn => {
|
||||
@ -33,9 +32,9 @@ export class Logger {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add message to logs & output
|
||||
*/
|
||||
/**
|
||||
* Add message to logs & output
|
||||
*/
|
||||
log(message) {
|
||||
this.ns.clearLog();
|
||||
this.header();
|
||||
|
Reference in New Issue
Block a user