source: java2python/tudutils-t/src/test/java/testcode/Reporter1.java

Last change on this file was 954, checked in by wouter, 4 months ago

translating to file seems working now.

File size: 716 bytes
RevLine 
[954]1package testcode;
2
3import java.io.File;
4import java.io.IOException;
5import java.nio.file.Files;
6import java.util.logging.Level;
7
8import org.eclipse.jdt.annotation.NonNull;
9
10import tudelft.utilities.logging.ReportToFile;
11import tudelft.utilities.logging.Reporter;
12
13/**
14 * Example that uses ImmutableList which is a custom external library.
15 */
16public 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.