package de.deadlocker8.budgetmaster.unit.helpers;

import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
import org.slf4j.LoggerFactory;

public class LoggerTestUtil
{
	public static ListAppender<ILoggingEvent> getListAppenderForClass(Class clazz)
	{
		Logger logger = (Logger) LoggerFactory.getLogger(clazz);

		ListAppender<ILoggingEvent> loggingEventListAppender = new ListAppender<>();
		loggingEventListAppender.start();

		logger.addAppender(loggingEventListAppender);

		return loggingEventListAppender;
	}
}
