{
render(): JSX.Element {
const e = this.props.log;
return (
- level: {e.level}
- msg: {e.msg}
- id: {e.id || "unknown"}
- file: {e.source || "(unknown)"}
- line: {e.line || "(unknown)"}
- col: {e.col || "(unknown)"}
{(e.detail ? - detail:
{e.detail}
: [])}
);
}
}
interface LogsState {
logs: LogEntry[]|undefined;
}
class Logs extends React.Component<{}, LogsState> {
constructor(props: {}) {
super({});
this.update();
this.state = {} as any;
}
async update() {
const logs = await getLogs();
this.setState({logs});
}
render(): JSX.Element {
const logs = this.state.logs;
if (!logs) {
return ...;
}
return (
Logs:
{logs.map((e) => )}
);
}
}
document.addEventListener("DOMContentLoaded", () => {
ReactDOM.render(, document.getElementById("container")!);
});