]> git.scottworley.com Git - tattlekey/commitdiff
server: Write CSV to log file
authorScott Worley <scottworley@scottworley.com>
Tue, 10 Oct 2023 23:44:08 +0000 (16:44 -0700)
committerScott Worley <scottworley@scottworley.com>
Wed, 11 Oct 2023 01:50:37 +0000 (18:50 -0700)
server/src/main.rs

index 071c4b26e74a7fc9103c76fd954c431abefaf9a1..a186abd58ec1b0e8045b0e29881fbcd7ecd76229 100644 (file)
@@ -80,7 +80,12 @@ impl Range {
 }
 
 fn main() {
 }
 
 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 {
     let mut presses = HashMap::<MessageKey, Range>::new();
     let socket = UdpSocket::bind("0.0.0.0:29803").expect("couldn't bind to address");
     loop {