Skip to content

Commit

Permalink
feat: add more logs
Browse files Browse the repository at this point in the history
Signed-off-by: Shengtuo Hu <[email protected]>
  • Loading branch information
h1994st committed Dec 18, 2024
1 parent 53b634f commit fc94042
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/bin/rllvm_get_bc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{fs, path::PathBuf};
use clap::Parser;
use log::LevelFilter;
use object::Object;
use rllvm::{error::Error, utils::*};
use rllvm::{config::rllvm_config, error::Error, utils::*};
use simple_logger::SimpleLogger;

/// Extraction arguments
Expand Down Expand Up @@ -39,9 +39,14 @@ pub fn main() -> Result<(), Error> {
let args = ExtractionArgs::parse();

// Set log level
let log_level = LevelFilter::iter()
.nth(1 + args.verbose as usize)
.unwrap_or(LevelFilter::max());
// The verbose flag will override the configured log level
let log_level = if args.verbose == 0 {
rllvm_config().log_level().to_level_filter()
} else {
LevelFilter::iter()
.nth(1 + args.verbose as usize)
.unwrap_or(LevelFilter::max())
};
if let Err(err) = SimpleLogger::new().with_level(log_level).init() {
let error_message = format!("Failed to set the logger: err={}", err);
log::error!("{}", error_message);
Expand Down Expand Up @@ -136,6 +141,7 @@ pub fn main() -> Result<(), Error> {
);
err
})?;
log::debug!("Bitcode filepaths: {:?}", bitcode_filepaths);
if args.save_manifest {
// Write bitcode filepaths into the manifest file
let input_parent_dir = input_filepath.parent().unwrap();
Expand Down

0 comments on commit fc94042

Please sign in to comment.