1 package com.srv4pos.server.api.infrastructure;
2
3 import java.io.PrintStream;
4
5 import static java.lang.String.format;
6
7
8
9
10 public class PrintStreamLogger implements Logger {
11 private PrintStream printStream;
12 private boolean printOk;
13
14 public PrintStreamLogger(PrintStream printStream, boolean printOk) {
15 this.printStream = printStream;
16 this.printOk = printOk;
17 }
18
19 public void log(String message) {
20 if (printOk) {
21 printStream.println(format("%-75s OK", message));
22 } else {
23 printStream.println(message);
24 }
25 }
26
27 public void log(String messagePattern, Object... objects) {
28 log(format(messagePattern, objects));
29 }
30 }