chore: logging

This commit is contained in:
2021-05-01 08:10:00 +08:00
parent a5f08b0258
commit 6819d49abf
3 changed files with 2040 additions and 8 deletions

4
.gitignore vendored
View File

@@ -6,10 +6,6 @@ __temp_dir/
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

2033
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@ use rust_util::XResult;
use acme_lib::{DirectoryUrl, Directory, create_p384_key, create_p256_key, create_rsa_key};
use acme_lib::persist::FilePersist;
use clap::{App, Arg};
use std::sync::{Arc, RwLock};
use std::sync::RwLock;
use std::collections::BTreeMap;
use tide::Request;
use std::process::exit;
@@ -20,7 +20,7 @@ const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
const DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
lazy_static! {
static ref TOKEN_MAP: Arc<RwLock<BTreeMap<String, String>>> = Arc::new(RwLock::new(BTreeMap::new()));
static ref TOKEN_MAP: RwLock<BTreeMap<String, String>> = RwLock::new(BTreeMap::new());
}
#[derive(Debug)]
@@ -123,7 +123,10 @@ fn request_domains(contract_email: &str, primary_name: &str, alt_names: &[&str],
let acc = opt_result!(dir.account(contract_email), "Directory set account failed: {}");
let mut ord_new = opt_result!( acc.new_order(primary_name, alt_names), "Create order failed: {}");
let mut order_csr_index = 0;
let ord_csr = loop {
information!("Loop for acme challenge auth, #{}", order_csr_index);
order_csr_index += 1;
if let Some(ord_csr) = ord_new.confirm_validations() {
break ord_csr;
}
@@ -142,7 +145,7 @@ fn request_domains(contract_email: &str, primary_name: &str, alt_names: &[&str],
opt_result!(chall.validate(timeout), "Validate challenge failed: {}");
}
opt_result!( ord_new.refresh(), "Refresh order failed: {}");
opt_result!(ord_new.refresh(), "Refresh order failed: {}");
};
information!("Generate private key, type: {:?}", algo);
@@ -153,7 +156,7 @@ fn request_domains(contract_email: &str, primary_name: &str, alt_names: &[&str],
};
information!("Created private key: {:?}", pkey_pri);
let ord_cert = opt_result!( ord_csr.finalize_pkey(pkey_pri, timeout), "Finalize private key failed: {}");
let ord_cert = opt_result!( ord_csr.finalize_pkey(pkey_pri, timeout), "Submit CSR failed: {}");
let cert = opt_result!( ord_cert.download_and_save_cert(), "Download and save certificate failed: {}");
information!("Created certificate: {:?}", cert);