optimize newline in logs
Signed-off-by: Valentyn Faychuk <valy@detee.ltd>
This commit is contained in:
		
							parent
							
								
									4d93229f19
								
							
						
					
					
						commit
						b8079b0981
					
				| @ -36,7 +36,7 @@ impl NodeInfo { | ||||
| 
 | ||||
|     pub fn log(&self, ip: &IP) { | ||||
|         let json = format!("{{\"ip\":\"{}\",", ip) + &self.to_json()[1..]; | ||||
|         if let Err(e) = Logfile::append(LOG_PATH, &format!("{}: {}", ip, &json)) { | ||||
|         if let Err(e) = Logfile::append(LOG_PATH, &format!("{}: {}\n", ip, &json)) { | ||||
|             println!("Could not log node info: {:?}", e); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -11,7 +11,6 @@ impl Logfile { | ||||
|     pub fn append(path: &str, msg: &str) -> Result<(), Box<dyn std::error::Error>> { | ||||
|         let mut file = std::fs::OpenOptions::new().create(true).append(true).open(path)?; | ||||
|         file.write_all(msg.as_bytes())?; | ||||
|         file.write_all(b"\n")?; | ||||
|         Ok(()) | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user