@@ -7,11 +7,11 @@ pub fn check_required_files(config: &RackConfig, target_directory_path: &Path) {
77 for required_filename in & config. artifact . required_files {
88 let required_file_path = target_directory_path. join ( required_filename) ;
99 if !required_file_path. exists ( ) {
10- eprintln ! ( "Required file of {:?} is missing" , required_file_path) ;
10+ log :: error !( "Required file of {:?} is missing" , required_file_path) ;
1111 std:: process:: exit ( 1 ) ;
1212 }
1313 }
14- println ! ( "Required files are present " ) ;
14+ log :: info !( "All required files are confirmed " ) ;
1515}
1616
1717pub fn check_optional_files ( config : & RackConfig , target_directory_path : & PathBuf ) {
@@ -31,12 +31,12 @@ pub fn check_optional_files(config: &RackConfig, target_directory_path: &PathBuf
3131 if !config. artifact . is_required_file ( & file_path)
3232 && !config. artifact . is_optional_file ( & file_path)
3333 {
34- eprintln ! ( "File {:?} is neither required nor optional" , file_path) ;
34+ log :: error !( "File {:?} is neither required nor optional" , file_path) ;
3535 std:: process:: exit ( 1 ) ;
3636 }
3737 }
3838
39- println ! ( "All files are required files or optional files" ) ;
39+ log :: info !( "All files are required files or optional files" ) ;
4040}
4141
4242pub fn check_version ( config : & RackConfig , config_dir : & PathBuf , target_directory_path : & Path ) {
@@ -48,28 +48,29 @@ pub fn check_version(config: &RackConfig, config_dir: &PathBuf, target_directory
4848 . project
4949 . is_valid_version ( & target_directory_path_from_config_dir)
5050 {
51- println ! ( "Version format is valid" ) ;
51+ log :: info !( "Version format is valid" ) ;
5252 } else {
53- eprintln ! (
53+ log :: error !(
5454 "Version format is invalid at {:?}. Please check ProjectConfig of {:?} " ,
55- target_directory_path_from_config_dir, config. project
55+ target_directory_path_from_config_dir,
56+ config. project
5657 ) ;
5758 std:: process:: exit ( 1 ) ;
5859 }
5960}
6061
6162pub fn write_result_to_readme ( config : & RackConfig , target_directory_path : & PathBuf ) {
6263 if config. document . template_file . is_some ( ) {
63- println ! ( "Write result of {:?} to README" , target_directory_path) ;
64+ log :: info !( "Write result of {:?} to README" , target_directory_path) ;
6465 }
6566}
6667
6768pub fn check ( target_directory_path : PathBuf ) {
6869 if !target_directory_path. exists ( ) {
69- eprintln ! ( "{:?} does not exist" , target_directory_path) ;
70+ log :: error !( "{:?} does not exist" , target_directory_path) ;
7071 std:: process:: exit ( 1 ) ;
7172 } else {
72- println ! (
73+ log :: info !(
7374 "Checking artifacts in rack at {:?}" ,
7475 target_directory_path. display( )
7576 ) ;
@@ -78,6 +79,5 @@ pub fn check(target_directory_path: PathBuf) {
7879 check_optional_files ( & config, & target_directory_path) ;
7980 check_version ( & config, & config_dir, & target_directory_path) ;
8081 write_result_to_readme ( & config, & target_directory_path) ;
81- println ! ( "All artifacts are valid." ) ;
8282 }
8383}
0 commit comments