cycles-sync: Fix logging (#5)
This commit is contained in:
parent
44861f07a4
commit
ba2146ff7d
3 changed files with 16 additions and 8 deletions
|
@ -18,7 +18,7 @@ use clap::Parser;
|
|||
use cosmwasm_std::HexBinary;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use tracing::{info, Level};
|
||||
use tracing::{debug, Level};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
|
@ -60,9 +60,10 @@ async fn main() -> Result<(), DynError> {
|
|||
.with_max_level(if cli.verbose {
|
||||
Level::DEBUG
|
||||
} else {
|
||||
Level::INFO
|
||||
Level::ERROR
|
||||
})
|
||||
.with_level(true)
|
||||
.with_writer(std::io::stderr)
|
||||
.init();
|
||||
|
||||
match cli.command {
|
||||
|
@ -115,7 +116,7 @@ async fn sync_setoffs(cli: Cli) -> Result<(), DynError> {
|
|||
})
|
||||
.collect();
|
||||
|
||||
info!("setoffs: {setoffs:?}");
|
||||
debug!("setoffs: {setoffs:?}");
|
||||
|
||||
// send to Obligato
|
||||
let client = HttpClient::new(OBLIGATO_URL.parse().unwrap());
|
||||
|
@ -136,13 +137,13 @@ async fn sync_obligations(cli: Cli, epoch_pk: &str) -> Result<(), DynError> {
|
|||
|
||||
add_default_acceptances(&mut intents, bank_id);
|
||||
|
||||
info!("intents: {intents:?}");
|
||||
debug!("intents: {intents:?}");
|
||||
|
||||
let intents_enc = {
|
||||
let epoch_pk = VerifyingKey::from_sec1_bytes(&hex::decode(epoch_pk).unwrap()).unwrap();
|
||||
encrypt_intents(intents, keys, &epoch_pk, cli.obligation_user_map_file)
|
||||
};
|
||||
info!("Encrypted {} intents", intents_enc.len());
|
||||
debug!("Encrypted {} intents", intents_enc.len());
|
||||
|
||||
let msg = create_wasm_msg(intents_enc);
|
||||
let wasmd_client = CliWasmdClient::new(cli.node);
|
||||
|
|
|
@ -2,6 +2,7 @@ use async_trait::async_trait;
|
|||
use reqwest::Url;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use tracing::log::debug;
|
||||
|
||||
use crate::{
|
||||
obligato_client::Client,
|
||||
|
@ -54,7 +55,7 @@ impl Client for HttpClient {
|
|||
.json(&setoffs)
|
||||
.send()
|
||||
.await?;
|
||||
println!("{}", response.text().await.unwrap());
|
||||
debug!("{}", response.text().await.unwrap());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::{error::Error, process::Command};
|
|||
use cosmrs::{tendermint::chain::Id, AccountId};
|
||||
use reqwest::Url;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::debug;
|
||||
|
||||
pub trait WasmdClient {
|
||||
type Address: AsRef<str>;
|
||||
|
@ -75,7 +76,7 @@ impl WasmdClient for CliWasmdClient {
|
|||
.args(["--output", "json"]);
|
||||
|
||||
let output = command.output()?;
|
||||
println!("{:?} => {:?}", command, output);
|
||||
debug!("{:?} => {:?}", command, output);
|
||||
|
||||
let query_result = R::from_vec(output.stdout);
|
||||
Ok(query_result)
|
||||
|
@ -97,10 +98,15 @@ impl WasmdClient for CliWasmdClient {
|
|||
.args(["--chain-id", chain_id.as_ref()])
|
||||
.args(["--gas", &gas.to_string()])
|
||||
.args(["--from", sender.as_ref()])
|
||||
.args(["--output", "json"])
|
||||
.arg("-y");
|
||||
|
||||
let output = command.output()?;
|
||||
println!("{:?} => {:?}", command, output);
|
||||
debug!("{:?} => {:?}", command, output);
|
||||
|
||||
if output.status.success() {
|
||||
println!("{}", String::from_utf8(output.stdout).unwrap());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue