Line | |
---|
1 | package testcode;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 | import java.io.IOException;
|
---|
5 | import java.nio.file.Files;
|
---|
6 | import java.util.logging.Level;
|
---|
7 |
|
---|
8 | import org.eclipse.jdt.annotation.NonNull;
|
---|
9 |
|
---|
10 | import tudelft.utilities.logging.ReportToFile;
|
---|
11 | import tudelft.utilities.logging.Reporter;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Example that uses ImmutableList which is a custom external library.
|
---|
15 | */
|
---|
16 | public class Reporter1 {
|
---|
17 | private static @NonNull File FILE = new File("test.log");
|
---|
18 |
|
---|
19 | static public void main(String[] args)
|
---|
20 | throws SecurityException, IOException {
|
---|
21 | final @NonNull Reporter reporter = new ReportToFile(FILE);
|
---|
22 | reporter.log(Level.INFO, "ok");
|
---|
23 | // this writes "ok" to the file
|
---|
24 |
|
---|
25 | System.out.println(new String(Files.readAllBytes(FILE.toPath())));
|
---|
26 | }
|
---|
27 |
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.