chiark / gitweb /
final printlns
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Sep 2020 00:57:38 +0000 (01:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Sep 2020 00:57:38 +0000 (01:57 +0100)
src/bin/server.rs
src/cmdlistener.rs
src/pieces.rs

index fceda973e9ebe707a3dd152bfc91d3e4875fd010..a0b13954449b0b9d1b8556e2c0f5e4546ff01dcd 100644 (file)
@@ -90,7 +90,7 @@ fn main() {
     if c.debug {
       rocket::config::Environment::Development
     } else {
-      eprintln!("requesting Production");
+      info!("requesting Production");
       rocket::config::Environment::Production
     }
   );
index 226598c2121419b0316474a7fba6aa5d81879d1e..1c338729717c89e13a642fbdf23530036bc1daf1 100644 (file)
@@ -39,7 +39,7 @@ pub struct CommandListener {
 
 #[throws(ME)]
 fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse {
-  eprintln!("command connection {}: executing {:?}", &cs.desc, &cmd);
+  info!("command connection {}: executing {:?}", &cs.desc, &cmd);
 
   match cmd {
     Noop => Fine,
@@ -73,9 +73,10 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse {
         .map_err(|e|{
           let name = ig.name.clone();
           Instance::destroy_game(ig)
-            .unwrap_or_else(|e|
- eprintln!("failed to tidy up failecd creation of {:?}: {:?}",
-                                      &name, &e));
+            .unwrap_or_else(|e| warn!(
+              "failed to tidy up failecd creation of {:?}: {:?}",
+              &name, &e
+            ));
           e
         })?;
 
@@ -435,7 +436,7 @@ impl CommandListener {
     thread::spawn(move ||{
       loop {
         self.accept_one().unwrap_or_else(
-          |e| eprintln!("accept/spawn failed: {:?}", e)
+          |e| error!("accept/spawn failed: {:?}", e)
         );
       }
     })
@@ -445,7 +446,7 @@ impl CommandListener {
   fn accept_one(&mut self) {
     let (conn, _caller) = self.listener.accept().context("accept")?;
     let mut desc = format!("{:>5}", conn.as_raw_fd());
-    eprintln!("command connection {}: accepted", &desc);
+    info!("command connection {}: accepted", &desc);
     thread::spawn(move||{
       match (||{
         let euid = conn.initial_peer_credentials()
@@ -479,8 +480,8 @@ impl CommandListener {
         
         <Result<_,StartupError>>::Ok(())
       })() {
-        Ok(()) => eprintln!("command connection {}: disconnected", &desc),
-        Err(e) => eprintln!("command connection {}: error: {:?}", &desc, e),
+        Ok(()) => info!("command connection {}: disconnected", &desc),
+        Err(e) => warn!("command connection {}: error: {:?}", &desc, e),
       }
     });
   }
@@ -510,8 +511,8 @@ impl CommandStream<'_> {
   }
 
   fn map_auth_err(&self, ae: AuthorisationError) -> MgmtError {
-    eprintln!("command connection {}: authorisation error: {}",
-              self.desc, ae.0);
+    warn!("command connection {}: authorisation error: {}",
+          self.desc, ae.0);
     MgmtError::AuthorisationError
   }
 }
index ea8df9b66fb44dc3e01315c2e3284562fe6d9f3c..092397ff9400616d70f97d7a4feb972280df022f 100644 (file)
@@ -80,7 +80,7 @@ pub fn svg_rescale_path(input: &str, scale: f64) -> String {
     write!(&mut out, "{}", w)?;
   }
 
-eprintln!("rescaled by {}: {} as {}",scale,&input,&out);
+  trace!("rescaled by {}: {} as {}",scale,&input,&out);
   out
 }