package com.gic.haoban.manage.web.controller;

import com.alibaba.fastjson.JSON;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.log.record.bean.WebErrorLogReport;
import com.gic.log.record.util.LogWebErrorLogReportUtil;
import org.apache.logging.log4j.LogManager;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @description:
 * @Author: wenhua
 * @Date: 2023/5/11 21:50
 */
@RestController
public class TabHaobanAppLogController {

    private static org.apache.logging.log4j.Logger logger = LogManager.getLogger(TabHaobanAppLogController.class);

    @RequestMapping("/insert_log")
    @ResponseBody
    @IgnoreLogin
    @com.gic.web.common.ano.IgnoreLogin
    public RestResponse<Boolean> insertLog(@RequestBody WebErrorLogReport qo) {
        logger.info("插入日志的参数：{}", JSON.toJSONString(qo));
        qo.setCreateTime(new Date());
        LogWebErrorLogReportUtil.pushWebErrorLogReport(qo);
        return RestResponse.successResult();
    }

}
