package kr.xit.core.biz.batch.listener;

import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;

import lombok.extern.slf4j.Slf4j;

/**
 * <pre>
 * description :  Job 실행시 로그 출력
 *
 * packageName : kr.xit.core.biz.batch.listener
 * fileName    : CustomJobListener
 * author      : limju
 * date        : 2023-05-16
 * ======================================================================
 * 변경일         변경자        변경 내용
 * ----------------------------------------------------------------------
 * 2023-05-16    limju       최초 생성
 *
 * </pre>
 */
@Slf4j
public class CustomJobListener extends JobExecutionListenerSupport {

    @Override
    public void beforeJob(JobExecution jobExecution) {
        log.info("\n");
        log.info("====================================================");
        log.info("========== ↓ [{}] Job start ===========", jobExecution.getJobInstance().getJobName());
        log.info("====================================================");
    }

    @Override
    public void afterJob(JobExecution jobExecution) {
        log.info("===============================================================");
        log.info("========== ↑ [{}] Job end :: {} ==========", jobExecution.getJobInstance().getJobName(), jobExecution.getStatus());
        log.info("===============================================================");
        log.info("\n");
    }
}
