import axios from 'axios';
let loginForm=JSON.parse(window.localStorage.getItem(`${location.host}loginForm`))
const writeLog=(type,data)=>{
  if(!loginForm) return;
  
  let log=type+' '+new Date().format('yyyy-MM-dd hh:mm:ss')+' '+loginForm.number+' '+location.host+' '+data
    axios.post("//"+document.location.logServe+"/ht/api/web/log/upload",{log:log}).then(res=>{
      if(res.code!=0){
        console.log('writeLog',res.msg)
      }
    }).catch(err=>{
      console.log('writeLog',err)
    })
}
export default writeLog
