Skip to content

Commit

Permalink
Merge pull request #175 from Alokit-Innovations/tr/fix/logs
Browse files Browse the repository at this point in the history
Add log fixes
  • Loading branch information
tapishr committed May 20, 2024
2 parents 048c2b0 + 8cccd09 commit 44a0108
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions vibi-dpu/src/core/review.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub async fn process_review(message_data: &Vec<u8>) {
return;
}
let (review, repo_config) = review_opt.expect("parse_opt is empty");
log::error!("[process_review] deserialized repo_config, review = {:?}, {:?}", &repo_config, &review);
log::debug!("[process_review] deserialized repo_config, review = {:?}, {:?}", &repo_config, &review);
if hunk_already_exists(&review) {
return;
}
Expand Down Expand Up @@ -65,7 +65,7 @@ pub async fn send_hunkmap(hunkmap_opt: &Option<HunkMap>, review: &Review,
fn hunk_already_exists(review: &Review) -> bool {
let hunk_opt = get_hunk_from_db(&review);
if hunk_opt.is_none() {
log::error!("[hunk_already_exists] No hunk from get_hunk_from_db");
log::debug!("[hunk_already_exists] No hunk from get_hunk_from_db");
return false;
}
let hunkmap = hunk_opt.expect("empty hunk from get_hunk_from_db");
Expand Down
3 changes: 2 additions & 1 deletion vibi-dpu/src/github/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn pat_access_token() -> Option<String> {
}
let github_pat = github_pat_res.expect("Empty GITHUB_PAT env var");
if github_pat.len() == 0 {
log::error!("[pat_access_token] GITHUB PAT 0 length");
log::debug!("[pat_access_token] GITHUB PAT 0 length");
return None;
}
log::debug!("[pat_access_token] GITHUB PAT: [REDACTED], length = {}",
Expand All @@ -222,5 +222,6 @@ pub async fn gh_access_token(review: &Option<Review>) -> Option<String> {
if let Some(pat_token) = pat_token_opt {
return Some(pat_token);
}
if review.is_none() { return None; }
return app_access_token(review).await;
}
2 changes: 1 addition & 1 deletion vibi-dpu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ async fn main() {
}

async fn load_auth_from_previous_installation() {
log::info!("Loading auth...");
if let Some(access_token) = gh_access_token(&None).await {
log::info!("Using Stored Auth...");
process_repos(&access_token, &ProviderEnum::Github.to_string()).await;
}
}
6 changes: 3 additions & 3 deletions vibi-dpu/src/utils/gitops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ pub fn commit_exists(commit: &str, directory: &str) -> bool {
.output();
if output_res.is_err() {
let e = output_res.expect_err("No error in output_res");
log::error!("[commit_exists] Failed to start git rev-list: {:?}", e);
log::debug!("[commit_exists] Failed to start git rev-list: {:?}", e);
return false;
}
let output = output_res.expect("Uncaught error in output_res");
if !output.status.success() {
log::error!("[commit_exists] git rev-list, exit code: {:?}",
log::debug!("[commit_exists] git rev-list, exit code: {:?}",
output.status.code());
// for debugging
match str::from_utf8(&output.stderr) {
Expand Down Expand Up @@ -115,7 +115,7 @@ fn set_git_url(git_url: &str, directory: &str, access_token: &str, repo_provider
Err(e) => {/* error handling */ log::error!("[set_git_url] stderr error {}", e)},
};
match str::from_utf8(&output.stdout) {
Ok(v) => log::error!("[set_git_url] stdout = {:?}", v),
Ok(v) => log::debug!("[set_git_url] stdout = {:?}", v),
Err(e) => {/* error handling */ log::error!("[set_git_url] stdout error {}", e)},
};
log::debug!("[set_git_url] set_git_url output = {:?}, {:?}", &output.stdout, &output.stderr);
Expand Down

0 comments on commit 44a0108

Please sign in to comment.