// var log4js = require('log4js');
var settings = require("../../config/settings");
const uuidv4 = require('uuid/v4');
const system = require("../system");
class LogClient {
  constructor() {
  }
  getUUID() {
    var uuid = uuidv4();
    var u = uuid.replace(/\-/g, "");
    return u;
  }
  async log(pobj, req, rtninfo, errinfo) {
    rtninfo.requestId = this.getUUID()
    req.params.param = pobj
    //第三个字段应该存公司id
    system.execLogs(settings.appname + "_" + req.xctx.codetitle, req.params, "_" + pobj.company_id + "_", rtninfo, errinfo).then(res => {
      if (res && res.status == 1) {
        console.log("log.....success")
      } else {
        console.log("log.....fail")
      }
    }).catch(e => {
      console.log("log.....fail")
    })
  }
}
module.exports = LogClient;
