All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.etlunit.PrintWriterLog Maven / Gradle / Ivy

package org.etlunit;

import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class PrintWriterLog implements Log
{
	private static final PrintWriter WRITER = new PrintWriter(new OutputStreamWriter(System.out));
	PrintWriter writer = WRITER;
	boolean suspended = false;

	@Override
	public void info(String message)
	{
		if (!suspended)
		{
			writer.println(message);
			writer.flush();
		}
	}

	@Override
	public void debug(String message)
	{
		if (!suspended)
		{
			writer.println(message);
			writer.flush();
		}
	}

	@Override
	public void severe(String message)
	{
		if (!suspended)
		{
			writer.println(message);
			writer.flush();
		}
	}

	@Override
	public void severe(String message, Throwable thr)
	{
		if (!suspended)
		{
			writer.println(message);
			thr.printStackTrace(writer);
			writer.flush();
		}
	}

	@Override
	public void suspend(boolean state)
	{
		suspended = state;
	}

	public void close()
	{
		writer.close();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy