chiark / gitweb /
logging conversion
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 5 Sep 2020 21:03:15 +0000 (22:03 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 5 Sep 2020 21:03:15 +0000 (22:03 +0100)
server.toml
src/api.rs
src/imports.rs

index e1046ba2ae901c25ee0a88c1bba803713bdcdec0..8d7d72bd5b0f3d127c78e92949833b2abf66d25b 100644 (file)
@@ -6,3 +6,6 @@ template_dir = "/home/ian/Rustup/Game/server/templates"
 
 [log]
 global_level = 'debug'
+
+[log.modules]
+'hyper::server' = 'info'
index 570da5f02aca2f39662d034c9c45eed861129a3e..b0da887ac3dae8845b0cecebb88a19ee557a84a0 100644 (file)
@@ -90,8 +90,6 @@ fn api_piece_op<O: ApiPieceOp>(form : Json<ApiPiece<O>>)
       if client == pc.lastclient { pc.gen_before_lastclient }
       else { pc.gen };
 
-    eprintln!("Q_GEN={:?} U_GEN={:?}", u_gen, q_gen);
-
     if u_gen > q_gen { throw!(PieceOpError::Conflict) }
     if pc.held != None && pc.held != Some(player) {
       throw!(OnlineError::PieceHeld)
@@ -112,7 +110,7 @@ fn api_piece_op<O: ApiPieceOp>(form : Json<ApiPiece<O>>)
       )?;
     },
     Err(ReportViaResponse(err)) => {
-      eprintln!("API ERROR => {:?}", &err);
+      warn!("api_piece_op ERROR {:?}: {:?}", &form, &err);
       Err(err)?;
     },
     Ok((update, logents)) => {
@@ -122,7 +120,7 @@ fn api_piece_op<O: ApiPieceOp>(form : Json<ApiPiece<O>>)
       buf.piece_update(piece, update, &lens);
       buf.log_updates(logents);
 
-      eprintln!("API {:?} OK", &form);
+      debug!("api_piece_op OK: {:?}", &form);
     }
   }
   ""
index 6ef553e8a4664d0698329b1e32e5e8ccf2c9a3bc..d09dd4a6e192833f79ee6d42d95fda9350ecf05e 100644 (file)
@@ -67,6 +67,8 @@ pub use regex::Regex;
 
 pub use arrayvec::ArrayVec;
 
+pub use log::{debug,warn};
+
 pub use flexi_logger::{LogSpecification};
 
 pub use crate::global::*;