Enhanced Logging (closes #27) #31
1 changed files with 3 additions and 1 deletions
|
@ -27,6 +27,7 @@ struct CloudflareApiResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct CloudflareZone {
|
pub(crate) struct CloudflareZone {
|
||||||
|
name: String,
|
||||||
email: String,
|
email: String,
|
||||||
key: String,
|
key: String,
|
||||||
id: String,
|
id: String,
|
||||||
|
@ -36,6 +37,7 @@ impl CloudflareZone {
|
||||||
pub(crate) fn new(zone: &ZoneConfig) -> Result<Self, VarError> {
|
pub(crate) fn new(zone: &ZoneConfig) -> Result<Self, VarError> {
|
||||||
let key = env::var("CF_API_TOKEN")?;
|
let key = env::var("CF_API_TOKEN")?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
name: zone.name.clone(),
|
||||||
email: zone.email.clone(),
|
email: zone.email.clone(),
|
||||||
key,
|
key,
|
||||||
id: zone.id.clone(),
|
id: zone.id.clone(),
|
||||||
|
@ -75,7 +77,7 @@ impl CloudflareZone {
|
||||||
|
|
||||||
Ok(entries.result)
|
Ok(entries.result)
|
||||||
} else {
|
} else {
|
||||||
let err_msg = format!("Unable to fetch Cloudflare Zone Entries. Error: {}", response.status());
|
let err_msg = format!("Unable to fetch Cloudflare Zone Entries for {}. Error: {}",self.name ,response.status());
|
||||||
match connected_to_journal() {
|
match connected_to_journal() {
|
||||||
true => error!("[ERROR] {err_msg}"),
|
true => error!("[ERROR] {err_msg}"),
|
||||||
false => eprintln!("[ERROR] {err_msg}"),
|
false => eprintln!("[ERROR] {err_msg}"),
|
||||||
|
|
Loading…
Reference in a new issue