This repository has been archived on 2022-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
irreligious/src/model/logging/DebugLogger.ts

18 lines
477 B
TypeScript
Raw Normal View History

2021-08-21 21:06:29 -05:00
class DebugLogger implements ILogger {
2021-09-05 14:45:37 -05:00
private readonly _container: HTMLElement;
2021-08-21 21:06:29 -05:00
constructor (container: HTMLElement) {
this._container = container;
}
public msg (text: string): void {
const p: HTMLElement = document.createElement('p');
p.innerText = text;
this._container.appendChild(p);
2021-09-05 14:45:37 -05:00
if (this._container.parentElement !== null) {
this._container.parentElement.scrollTop =
this._container.parentElement.scrollHeight;
}
2021-08-21 21:06:29 -05:00
}
}