Skip to content

Commit

Permalink
add logs (#60)
Browse files Browse the repository at this point in the history
* add logs

* clean logs
  • Loading branch information
JettTech authored Aug 6, 2024
1 parent cf75007 commit 503a1ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
12 changes: 11 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use anyhow::Result;
use holochain_types::dna::{hash_type::Agent, HoloHash};
use hpos_hc_connect::{hha_agent::CoreAppAgent, holo_config::Config};
use std::collections::HashMap;
use tracing::{debug, error, info};
use tracing::{debug, error, info, trace};
use types::hbs::{HbsClient, KycLevel};
use types::PublishedHappDetails;
use utils::{
Expand Down Expand Up @@ -38,12 +38,17 @@ pub async fn run(config: &Config) -> Result<()> {
debug!("Got host credentials from hbs {:?}", host_credentials);

let mut core_app = CoreAppAgent::spawn(Some(config)).await?;
trace!("Connected to core app interface.");

// Suspend happs that have overdue payments
let pending_transactions = core_app.get_pending_transactions().await?;
trace!("Got pending_transactions : {:?}", pending_transactions);

let suspended_happs = get_suspended_happs(pending_transactions);
trace!("Got suspended_happs : {:#?}", suspended_happs);

let published_happs = get_all_published_hosted_happs(&mut core_app).await?;
trace!("Got published_happs : {:#?}", published_happs);

// Get happ jurisdictions AND publisher jurisdiction for each happ
let mut published_happ_details: HashMap<String, PublishedHappDetails> = HashMap::new();
Expand Down Expand Up @@ -72,6 +77,11 @@ pub async fn run(config: &Config) -> Result<()> {
let jurisdiction = core_app
.get_publisher_jurisdiction(publisher_pubkey.clone())
.await?;
trace!(
"Got jurisdiction for publisher {:?} : {:?}",
publisher_pubkey,
jurisdiction
);
publisher_jurisdictions.insert(publisher_pubkey, jurisdiction.clone());
published_happ_details.insert(
happ.happ_id.clone().to_string(),
Expand Down
2 changes: 0 additions & 2 deletions src/types/hbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ impl HbsClient {
)
.await?;

tracing::trace!("Signature: {:?}", signature);

let connection = Self::connect()?;
let mut headers = reqwest::header::HeaderMap::new();

Expand Down
1 change: 1 addition & 0 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use holochain_types::dna::ActionHashB64;
use holochain_types::prelude::{holochain_serial, SerializedBytes};
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Clone)]
pub struct HappBundle {
pub happ_id: ActionHashB64,
pub bundle_url: String,
Expand Down
5 changes: 2 additions & 3 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,7 @@ pub async fn install_holo_hosted_happs(
.await
.context("failed to get enabled hApps")?,
);
trace!("enabled_happ_ids {:?}", enabled_happ_ids);

let client = reqwest::Client::new();
trace!("enabled_happ_ids {:#?}", enabled_happ_ids);

// Iterate through the vec and
// Call http://localhost/api/v2/apps/hosted/install
Expand Down Expand Up @@ -363,6 +361,7 @@ pub async fn install_holo_hosted_happs(
preferences: preferences.clone(),
membrane_proofs: mem_proof.clone(),
};
let client = reqwest::Client::new();
let response = client
.post("http://localhost/api/v2/apps/hosted/install")
.json(&body)
Expand Down

0 comments on commit 503a1ce

Please sign in to comment.