import React from 'react'; import { FormBuilder, Loader, Button, Icon } from '../../components/'; import { Config, Log } from '../../model/'; import { FormObjToJSON, notify } from '../../helpers/'; import "./logger.scss"; export class LogPage extends React.Component { constructor(props){ super(props); this.state = { form: {}, loading: false, log: "", config: {} }; } componentWillMount(){ Config.all().then((config) => { this.setState({ form: {"":{"params":config["log"]}}, config: FormObjToJSON(config) }); }); Log.get(1024*100).then((log) => { // get only the last 100kb of log this.setState({log: log}, () => { this.refs.$log.scrollTop = this.refs.$log.scrollHeight; }); }); } onChange(r){ this.state.config["log"] = r[""].params; this.state.config["connections"] = window.CONFIG.connections; this.setState({loading: true}, () => { Config.save(this.state.config, false, () => { this.setState({loading: false}); }, () => { notify.send("Error while saving config", "error"); this.setState({loading: false}); }); }); } render(){ const filename = () => { let tmp = "access_"; tmp += new Date().toISOString().substring(0,10).replace(/-/g, ""); tmp += ".log"; } return (

Logging { this.state.loading === true ? : null}

                {
                    this.state.log === "" ?  : this.state.log + "\n\n\n\n\n"
                }
              
); } }