aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2020-10-02 18:36:57 -0400
committerGitHub <noreply@github.com>2020-10-02 18:36:57 -0400
commitfa13e57835e487d586024a2e065e8f4b30dc88cd (patch)
treee62623fec8d1f3e376453cb33ad0e42b2019b589 /src/app
parenta6ee2e7e36e8e8fac6f7c5f452cd6a0a06790584 (diff)
downloadxesite-fa13e57835e487d586024a2e065e8f4b30dc88cd.tar.xz
xesite-fa13e57835e487d586024a2e065e8f4b30dc88cd.zip
incorporate tracing instead of log (#222)
* incorporate tracing instead of log * fix a test * fix a test
Diffstat (limited to 'src/app')
-rw-r--r--src/app/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 44f05e7..035db07 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -2,6 +2,7 @@ use crate::{post::Post, signalboost::Person};
use color_eyre::eyre::Result;
use serde::Deserialize;
use std::{fs, path::PathBuf};
+use tracing::{instrument, error};
pub mod markdown;
@@ -15,9 +16,10 @@ pub struct Config {
resume_fname: PathBuf,
}
+#[instrument]
async fn patrons() -> Result<Option<patreon::Users>> {
use patreon::*;
- let creds: Credentials = envy::prefixed("PATREON_").from_env().unwrap();
+ let creds: Credentials = envy::prefixed("PATREON_").from_env().unwrap_or(Credentials::default());
let cli = Client::new(creds);
match cli.campaign().await {
@@ -27,13 +29,13 @@ async fn patrons() -> Result<Option<patreon::Users>> {
match cli.pledges(id).await {
Ok(users) => Ok(Some(users)),
Err(why) => {
- log::error!("error getting pledges: {:?}", why);
+ error!("error getting pledges: {}", why);
Ok(None)
}
}
}
Err(why) => {
- log::error!("error getting patreon campaign: {:?}", why);
+ error!("error getting patreon campaign: {}", why);
Ok(None)
}
}
@@ -134,7 +136,6 @@ mod tests {
use color_eyre::eyre::Result;
#[tokio::test]
async fn init() -> Result<()> {
- let _ = pretty_env_logger::try_init();
super::init("./config.dhall".into()).await?;
Ok(())
}