Projects
Eulaceura:Factory
secGear
_service:obs_scm:0083-optimize-log-level.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0083-optimize-log-level.patch of Package secGear
From 93b932412c210f10464502d81c2973065ae1e614 Mon Sep 17 00:00:00 2001 From: houmingyong <houmingyong@huawei.com> Date: Fri, 30 Aug 2024 19:42:37 +0800 Subject: [PATCH 2/2] optimize log level Signed-off-by: houmingyong <houmingyong@huawei.com> --- .../agent/src/bin/aa-test/main.rs | 43 +++++++++++-------- .../attestation-agent/agent/src/lib.rs | 4 +- .../attestation-agent/agent/src/main.rs | 2 +- .../verifier/src/virtcca/mod.rs | 2 +- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/service/attestation/attestation-agent/agent/src/bin/aa-test/main.rs b/service/attestation/attestation-agent/agent/src/bin/aa-test/main.rs index 58fc389d..89a301bf 100644 --- a/service/attestation/attestation-agent/agent/src/bin/aa-test/main.rs +++ b/service/attestation/attestation-agent/agent/src/bin/aa-test/main.rs @@ -21,7 +21,7 @@ const TEST_THREAD_NUM: i64 = 1; // multi thread num #[tokio::main] async fn main() { - env_logger::init(); + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); let mut handles = Vec::with_capacity(TEST_THREAD_NUM as usize); for i in 0..TEST_THREAD_NUM { let t = tokio::spawn(async move {aa_proc(i).await;}); @@ -31,13 +31,14 @@ async fn main() { for handle in handles { let _ = tokio::join!(handle); } - println!("main stop"); + log::info!("main stop"); } async fn aa_proc(i: i64) { - println!("attestation_proc {} start", i); + log::info!("attestation_proc thread {} start", i); // get challenge + log::info!("thread {} case1 get challenge", i); let client = reqwest::Client::new(); let challenge_endpoint = "http://127.0.0.1:8081/challenge"; let res = client @@ -52,11 +53,11 @@ async fn aa_proc(i: i64) { let challenge = match res.status() { reqwest::StatusCode::OK => { let respone = res.text().await.unwrap(); - println!("get challenge success, AA Response: {:?}", respone); + log::info!("thread {} case1 get challenge success response: {:?}", i, respone); respone } status => { - println!("get challenge Failed, AA Response: {:?}", status); + log::error!("thread {} case1 get challenge failed response: {:?}", i, status); return; } }; @@ -66,7 +67,7 @@ async fn aa_proc(i: i64) { "challenge": challenge, "uuid": String::from("f68fd704-6eb1-4d14-b218-722850eb3ef0"), }); - + log::info!("thread {} case2 get evidence, request body: {}", i, request_body); let attest_endpoint = "http://127.0.0.1:8081/evidence"; let res = client .get(attest_endpoint) @@ -79,11 +80,12 @@ async fn aa_proc(i: i64) { let evidence = match res.status() { reqwest::StatusCode::OK => { let respone = res.text().await.unwrap(); - println!("get evidence success, AA Response: {:?}", respone); + log::info!("thread {} case2 get evidence success", i); + log::debug!("thread {} response: {:?}", i, respone); respone } status => { - println!("get evidence Failed, AA Response: {:?}", status); + log::error!("thread {} case2 get evidence failed response: {:?}", i, status); return; } }; @@ -94,7 +96,7 @@ async fn aa_proc(i: i64) { "challenge": "", "evidence": evidence, }); - + log::info!("thread {} case3 verify evidence with no challenge", i); let res = client .post(attest_endpoint) .header("Content-Type", "application/json") @@ -106,10 +108,10 @@ async fn aa_proc(i: i64) { match res.status() { reqwest::StatusCode::OK => { let respone = res.text().await.unwrap(); - println!("verify evidence with no challenge success, AA Response: {:?}", respone); + log::info!("thread {} case3 verify evidence with no challenge success response: {:?}", i, respone); } status => { - println!("verify evidence with no challenge Failed, AA Response: {:?}", status); + log::error!("thread {} case3 verify evidence with no challenge failed response: {:?}", i, status); } } } @@ -118,7 +120,7 @@ async fn aa_proc(i: i64) { "challenge": challenge, "evidence": evidence, }); - + log::info!("thread {} case4 verify evidence with challenge", i); let res = client .post(attest_endpoint) .header("Content-Type", "application/json") @@ -130,10 +132,10 @@ async fn aa_proc(i: i64) { match res.status() { reqwest::StatusCode::OK => { let respone = res.text().await.unwrap(); - println!("verify evidence success, AA Response: {:?}", respone); + log::info!("thread {} case4 verify evidence success response: {:?}", i, respone); } status => { - println!("verify evidence Failed, AA Response: {:?}", status); + log::error!("thread {} case4 verify evidence failed response: {:?}", i, status); } } @@ -145,6 +147,7 @@ async fn aa_proc(i: i64) { "challenge": challenge, "uuid": String::from("f68fd704-6eb1-4d14-b218-722850eb3ef0"), }); + log::info!("thread {} case5 get token, request body: {}", i, request_body); let res = client .get(token_endpoint) @@ -157,11 +160,12 @@ async fn aa_proc(i: i64) { let token = match res.status() { reqwest::StatusCode::OK => { let respone = res.text().await.unwrap(); - println!("get token success, AA Response: {:?}", respone); + log::info!("thread {} case5 get token success", i); + log::debug!("thread {} response: {:?}", i, respone); respone } status => { - println!("get token Failed, AA Response: {:?}", status); + log::error!("thread {} case5 get token failed response: {:?}", i, status); return; } }; @@ -171,6 +175,7 @@ async fn aa_proc(i: i64) { "token": token, }); + log::info!("thread {} case6 verify token", i); let res = client .post(token_endpoint) .header("Content-Type", "application/json") @@ -182,14 +187,14 @@ async fn aa_proc(i: i64) { match res.status() { reqwest::StatusCode::OK => { let respone = res.text().await.unwrap(); - println!("verify token success, AA Response: {:?}", respone); + log::info!("thread {} case6 verify token success response: {:?}", i, respone); } status => { - println!("verify token Failed, AA Response: {:?}", status); + log::error!("thread {} case6 verify token failed response: {:?}", i, status); } } } - println!("attestation_proc {} end", i); + log::info!("attestation_proc thread {} end", i); } \ No newline at end of file diff --git a/service/attestation/attestation-agent/agent/src/lib.rs b/service/attestation/attestation-agent/agent/src/lib.rs index 4ff9b585..c4d913b6 100644 --- a/service/attestation/attestation-agent/agent/src/lib.rs +++ b/service/attestation/attestation-agent/agent/src/lib.rs @@ -266,11 +266,11 @@ impl AttestationAgent { let challenge = match res.status() { reqwest::StatusCode::OK => { let respone = res.json().await.unwrap(); - log::info!("get challenge success, AS Response: {:?}", respone); + log::debug!("get challenge success, AS Response: {:?}", respone); respone } status => { - log::info!("get challenge Failed, AS Response: {:?}", status); + log::error!("get challenge Failed, AS Response: {:?}", status); bail!("get challenge Failed") } }; diff --git a/service/attestation/attestation-agent/agent/src/main.rs b/service/attestation/attestation-agent/agent/src/main.rs index 76e63dc4..62a4b4d2 100644 --- a/service/attestation/attestation-agent/agent/src/main.rs +++ b/service/attestation/attestation-agent/agent/src/main.rs @@ -43,7 +43,7 @@ struct Cli { #[actix_web::main] async fn main() -> Result<()> { - env_logger::init_from_env(env_logger::Env::new().default_filter_or("debug")); + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); let cli = Cli::parse(); let server = AttestationAgent::new(Some(cli.config)).unwrap(); diff --git a/service/attestation/attestation-service/verifier/src/virtcca/mod.rs b/service/attestation/attestation-service/verifier/src/virtcca/mod.rs index a99f9358..3de7c9f4 100644 --- a/service/attestation/attestation-service/verifier/src/virtcca/mod.rs +++ b/service/attestation/attestation-service/verifier/src/virtcca/mod.rs @@ -264,7 +264,7 @@ impl Evidence { let ret = evidence.cvm_envelop.init_decoder(None); match ret { - Ok(_) => log::info!("decode COSE success"), + Ok(_) => log::debug!("decode COSE success"), Err(e) => { log::error!("decode COSE failed, {:?}", e); bail!("decode COSE failed"); -- 2.46.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2