mirror of
https://codeberg.org/slatian/service.echoip-slatecave.git
synced 2025-03-03 20:04:19 +01:00
Log not found errors to the debug channel
They are part of normal operation and shouldn't be logged in production.
This commit is contained in:
parent
caf47522e4
commit
ba34caf8fc
21
src/geoip.rs
21
src/geoip.rs
@ -3,9 +3,10 @@
|
||||
* that provides the results ready for templating.
|
||||
*/
|
||||
|
||||
use log::{info,warn,error};
|
||||
use log::{debug,info,warn,error};
|
||||
use maxminddb::geoip2;
|
||||
|
||||
use maxminddb::MaxMindDBError::AddressNotFoundError;
|
||||
use parking_lot::RwLock;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
@ -135,9 +136,15 @@ impl QueryAsn for MMDBCarrier {
|
||||
name: res.autonomous_system_organization.map(ToString::to_string),
|
||||
})
|
||||
},
|
||||
Err(AddressNotFoundError(_)) => {
|
||||
// Log to the debug channel.
|
||||
// This isn't severe, and shouldn't be logged in production.
|
||||
debug!("ASN not found in database for {address}.");
|
||||
None
|
||||
},
|
||||
Err(e) => {
|
||||
error!("Error while looking up ASN for {address}: {e}");
|
||||
Default::default()
|
||||
None
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -203,9 +210,15 @@ impl QueryLocation for MMDBCarrier {
|
||||
},
|
||||
})
|
||||
},
|
||||
Err(AddressNotFoundError(_)) => {
|
||||
// Log to the debug channel.
|
||||
// This isn't severe, and shouldn't be logged in production.
|
||||
debug!("IP location not found in database for {address}");
|
||||
None
|
||||
},
|
||||
Err(e) => {
|
||||
error!("Error while looking up ASN for {address}: {e}");
|
||||
Default::default()
|
||||
error!("Error while looking up IP location for {address}: {e}");
|
||||
None
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -111,6 +111,7 @@ impl AddressInfo {
|
||||
scope: address_scope
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user