package org.springblade.risk.log.listener;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.event.ErrorLogEvent;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author: lianghanqiang
 * @description: 错误 日志收集
 * @since: 10/27/21 -- 2:57 PM
 */

@Slf4j
@Component
@AllArgsConstructor
public class LdtErrLogListener {

//	private RabbitTemplate rabbitTemplate;

	@Async
	@EventListener({ErrorLogEvent.class})
	public void saveApiLog(ErrorLogEvent event) {
		String data = JSON.toJSONString(event.getSource());
		System.out.println(data);
	}
}
