]> git.scottworley.com Git - tattlekey/blobdiff - server/src/main.rs
server: Write CSV to log file
[tattlekey] / server / src / main.rs
index 071c4b26e74a7fc9103c76fd954c431abefaf9a1..a186abd58ec1b0e8045b0e29881fbcd7ecd76229 100644 (file)
@@ -80,7 +80,12 @@ impl Range {
 }
 
 fn main() {
-    let mut log = csv::Writer::from_writer(std::io::stdout());
+    let logfile = std::fs::OpenOptions::new()
+        .create(true)
+        .append(true)
+        .open("log.csv")
+        .expect("Coudln't open log file");
+    let mut log = csv::Writer::from_writer(logfile);
     let mut presses = HashMap::<MessageKey, Range>::new();
     let socket = UdpSocket::bind("0.0.0.0:29803").expect("couldn't bind to address");
     loop {