Skip to content
Snippets Groups Projects
Commit 9226879b authored by brinn's avatar brinn
Browse files

Allow to choose the PrintStream for the simple console logger.

SVN: 28659
parent cc2c2316
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package ch.systemsx.cisd.common.logging; package ch.systemsx.cisd.common.logging;
import java.io.PrintStream;
/** /**
* A {@link ISimpleLogger} that logs to {@link System#out} (for debugging purposes). * A {@link ISimpleLogger} that logs to {@link System#out} (for debugging purposes).
* *
...@@ -24,10 +26,22 @@ package ch.systemsx.cisd.common.logging; ...@@ -24,10 +26,22 @@ package ch.systemsx.cisd.common.logging;
public class ConsoleLogger implements ISimpleLogger public class ConsoleLogger implements ISimpleLogger
{ {
private final PrintStream pstream;
public ConsoleLogger()
{
this(System.out);
}
public ConsoleLogger(PrintStream pstream)
{
this.pstream = pstream;
}
@Override @Override
public void log(LogLevel level, String message) public void log(LogLevel level, String message)
{ {
System.out.println(level.toString() + ": " + message); pstream.println(level.toString() + ": " + message);
} }
@Override @Override
...@@ -36,7 +50,7 @@ public class ConsoleLogger implements ISimpleLogger ...@@ -36,7 +50,7 @@ public class ConsoleLogger implements ISimpleLogger
log(level, message); log(level, message);
if (throwableOrNull != null) if (throwableOrNull != null)
{ {
throwableOrNull.printStackTrace(); throwableOrNull.printStackTrace(pstream);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment