blob: b7c8f3f2e528d8f632ae0aba195a3bd96f684c65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package de.romjaki.logger.impl;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileLogger extends StreamLogger {
public FileLogger(String name, File file) throws IOException {
super(name, new FileOutputStream(createFile(file)));
}
public FileLogger(File file) throws IOException {
super(new FileOutputStream(createFile(file)));
}
private static File createFile(File file) throws IOException {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists()) {
file.createNewFile();
}
return file;
}
}
|