mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2025-07-16 22:13:30 +02:00
Use the log create instead of println
This commit is contained in:
13
src/geoip.rs
13
src/geoip.rs
@ -3,6 +3,7 @@
|
||||
* that provides the results ready for templating.
|
||||
*/
|
||||
|
||||
use log::{info,warn,error};
|
||||
use maxminddb;
|
||||
use maxminddb::geoip2;
|
||||
|
||||
@ -136,7 +137,7 @@ impl QueryAsn for MMDBCarrier {
|
||||
})
|
||||
},
|
||||
Err(e) => {
|
||||
println!("Error while looking up ASN for {address}: {e}");
|
||||
error!("Error while looking up ASN for {address}: {e}");
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
@ -204,7 +205,7 @@ impl QueryLocation for MMDBCarrier {
|
||||
})
|
||||
},
|
||||
Err(e) => {
|
||||
println!("Error while looking up ASN for {address}: {e}");
|
||||
error!("Error while looking up ASN for {address}: {e}");
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
@ -232,7 +233,7 @@ impl MMDBCarrier {
|
||||
|
||||
pub fn load_database_from_path(&self, path: &Path) -> Result<(),maxminddb::MaxMindDBError> {
|
||||
let mut mmdb = self.mmdb.write();
|
||||
println!("Loading {} from '{}' ...", &self.name, path.display());
|
||||
info!("Loading {} from '{}' ...", &self.name, path.display());
|
||||
match maxminddb::Reader::open_readfile(path) {
|
||||
Ok(reader) => {
|
||||
let wording = if mmdb.is_some() {
|
||||
@ -241,13 +242,13 @@ impl MMDBCarrier {
|
||||
"Loaded new"
|
||||
};
|
||||
*mmdb = Some(reader);
|
||||
println!("{} {} with new one.", wording, &self.name);
|
||||
info!("{} {} with new one.", wording, &self.name);
|
||||
Ok(())
|
||||
},
|
||||
Err(e) => {
|
||||
println!("Error while reading {}: {}", &self.name, &e);
|
||||
error!("Error while reading {}: {}", &self.name, &e);
|
||||
if mmdb.is_some() {
|
||||
println!("Not replacing old database.");
|
||||
warn!("Not replacing old database.");
|
||||
}
|
||||
Err(e)
|
||||
},
|
||||
|
Reference in New Issue
Block a user