More cleanup

This commit is contained in:
2022-03-15 22:05:34 -04:00
parent d699112d38
commit 3753ae02db
4 changed files with 86 additions and 97 deletions

View File

@ -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();