POB_2019/Java/zad3_1/FileLogger.java

18 lines
494 B
Java
Raw Normal View History

2019-04-14 13:42:06 +02:00
package POB_2019.Java.zad3_1;
import java.io.FileWriter;
import java.io.IOException;
public class FileLogger extends Logger {
private FileWriter fileWriter;
public FileLogger() throws IOException {
String fileName = "./log.txt";
this.fileWriter = new FileWriter(fileName);
}
@Override
public void log(String textToLog) throws IOException {
this.fileWriter.append(textToLog);
this.fileWriter.append("\n");
fileWriter.flush();
}
}