1 import java.util.logging.*;
 2 import edu.wpi.first.wpilibj.PowerDistributionPanel;
 3 
 4 public class Log {
 5         public static final String logfile = "/home/lvuser/Logs/log";
 6         public static FileHandler logFile;
 7         public static Logger logMe = Logger.getGlobal();
 8 
 9         void initLogger(String startFileName) {
10                 if (startFileName == null) {
11                         startFileName = "./log0";
12                 }
13                 java.util.Date today = new java.util.Date();
14                 String filename = startFileName + today.getDay() + "-" + today.getHours() + "-" + today.getMinutes();
15                 try {
16                         logFile = new FileHandler(filename);
17                         logFile.setFormatter(new SimpleFormatter());
18                         logMe = Logger.getGlobal();
19                         logMe.addHandler(logFile);
20                         logMe.setLevel(Level.INFO);
21                         logMe.log(Level.INFO, "Logging Messages:");
22 
23                 } catch (Exception e) {
24                         System.out.println("Unable to init log file:" + filename);
25                         System.out.println(e);
26                 }
27 
28         }
29         
30         public static void main(String[] args) {
31                 logMe.log(Level.INFO, "Voltage: " + PDP.getVoltage());
32         }
33 }