Add logger component

This commit is contained in:
2020-04-12 19:05:01 +03:00
parent abde52449f
commit 9d85d07ff5
8 changed files with 88 additions and 73 deletions

View File

@ -13,6 +13,7 @@ import {
import Vue from 'vue';
import DashboardApp from './Components/DashboardApp.vue';
import { ResourcesToLevel } from '../Task/ResourcesToLevel';
import { Logger } from '../Logger';
interface QuickAction {
label: string;
@ -22,17 +23,19 @@ interface QuickAction {
export class Dashboard {
private readonly version: string;
private scheduler: Scheduler;
private readonly logger;
constructor(version: string, scheduler: Scheduler) {
this.version = version;
this.scheduler = scheduler;
this.logger = new Logger(this.constructor.name);
}
async run() {
await waitForLoad();
const p = new URLParse(window.location.href, true);
this.log('PARSED LOCATION', p);
this.logger.log('PARSED LOCATION', p);
const villageId = grabActiveVillageId();
@ -116,12 +119,4 @@ export class Dashboard {
const n = new Notification(`Building ${buildId} scheduled`);
setTimeout(() => n && n.close(), 4000);
}
private log(...args) {
console.log('SCHEDULER:', ...args);
}
private logError(...args) {
console.error(...args);
}
}