package com.uas.platform.b2b.erp.support;

import com.uas.platform.b2b.core.util.ContextUtils;
import com.uas.platform.b2b.core.util.PathUtils;
import com.uas.platform.b2b.erp.model.ErpLog;
import com.uas.platform.b2b.erp.service.ErpLogService;
import com.uas.platform.core.logging.BufferedLogger;

/**
 * erp交互的异步日志记录的工具
 * 
 * @author yingp
 * 
 */
public class ErpBufferedLogger extends BufferedLogger<ErpLog> {

	public ErpBufferedLogger() {
		super(PathUtils.getFilePath(), ErpLog.class, ContextUtils.getBean(ErpLogService.class));
	}

	/**
	 * 记录erp交互日志
	 * 
	 * @param title
	 *            消息标题
	 * @param message
	 *            消息
	 * @param total
	 *            数据量
	 */
	public void log(String title, String message, int total) {
		// 有数据量才记录
		if (total > 0) {
            log(new ErpLog(title, message, total));
        }
	}

}
