@@ -29,7 +29,7 @@ use crate::diagnostic::{Diagnostics, Warnings};
2929use crate :: error:: * ;
3030use crate :: lockfile:: * ;
3131use crate :: sess:: { Session , SessionArenas , SessionIo } ;
32- use crate :: { debugln , fmt_path, fmt_pkg, stageln} ;
32+ use crate :: { fmt_path, fmt_pkg, stageln} ;
3333
3434#[ derive( Parser , Debug ) ]
3535#[ command( name = "bender" ) ]
@@ -84,16 +84,6 @@ struct Cli {
8484 ) ]
8585 verbose : u8 ,
8686
87- /// Print additional debug information
88- #[ cfg( debug_assertions) ]
89- #[ arg(
90- long,
91- global = true ,
92- help_heading = "Global Options" ,
93- env = "BENDER_DEBUG"
94- ) ]
95- debug : bool ,
96-
9787 #[ command( subcommand) ]
9888 command : Commands ,
9989}
@@ -170,11 +160,6 @@ pub fn main() -> Result<()> {
170160 // Initialize warning and error handling with the suppression arguments.
171161 Diagnostics :: init ( suppressed_warnings) ;
172162
173- #[ cfg( debug_assertions) ]
174- if cli. debug {
175- ENABLE_DEBUG . store ( true , std:: sync:: atomic:: Ordering :: Relaxed ) ;
176- }
177-
178163 // Handle commands that do not require a session.
179164 match & cli. command {
180165 Commands :: Completion ( args) => {
@@ -202,16 +187,16 @@ pub fn main() -> Result<()> {
202187 None => find_package_root ( Path :: new ( "." ) )
203188 . map_err ( |cause| Error :: chain ( "Cannot find root directory of package." , cause) ) ?,
204189 } ;
205- debugln ! ( "main: root dir {:?}" , root_dir) ;
190+ log :: debug !( "root dir {:?}" , root_dir) ;
206191
207192 // Parse the manifest file of the package.
208193 let manifest_path = root_dir. join ( "Bender.yml" ) ;
209194 let manifest = read_manifest ( & manifest_path) ?;
210- debugln ! ( "main: {:#?}" , manifest) ;
195+ log :: debug !( "{:#?}" , manifest) ;
211196
212197 // Gather and parse the tool configuration.
213198 let config = load_config ( & root_dir, matches ! ( cli. command, Commands :: Update ( _) ) ) ?;
214- debugln ! ( "main: {:#?}" , config) ;
199+ log :: debug !( "{:#?}" , config) ;
215200
216201 // Determine git throttle. The precedence is: CLI argument, env variable, config file, default (4).
217202 let git_throttle = cli. git_throttle . or ( config. git_throttle ) . unwrap_or ( 4 ) ;
@@ -251,7 +236,7 @@ pub fn main() -> Result<()> {
251236 cmd:: update:: run_plain ( false , & sess, locked_existing. as_ref ( ) , IndexSet :: new ( ) ) ?
252237 }
253238 _ => {
254- debugln ! ( "main: lockfile {:?} up-to-date" , lock_path) ;
239+ log :: debug !( "lockfile {:?} up-to-date" , lock_path) ;
255240 ( locked_existing. unwrap ( ) , Vec :: new ( ) )
256241 }
257242 } ;
@@ -262,7 +247,7 @@ pub fn main() -> Result<()> {
262247 {
263248 let io = SessionIo :: new ( & sess) ;
264249 for ( path, pkg_name) in & sess. manifest . workspace . package_links {
265- debugln ! ( "main: maintaining link to {} at {:?}" , pkg_name, path) ;
250+ log :: debug !( "maintaining link to {} at {:?}" , pkg_name, path) ;
266251
267252 // Determine the checkout path for this package.
268253 let pkg_path = io. get_package_path ( sess. dependency_with_name ( pkg_name) ?) ;
@@ -293,7 +278,7 @@ pub fn main() -> Result<()> {
293278 continue ;
294279 }
295280 if path. read_link ( ) . map ( |d| d != pkg_path) . unwrap_or ( true ) {
296- debugln ! ( "main: removing existing link {:?}" , path) ;
281+ log :: debug !( "removing existing link {:?}" , path) ;
297282 remove_symlink_dir ( path) . map_err ( |cause| {
298283 Error :: chain (
299284 format ! ( "Failed to remove symlink at path {:?}." , path) ,
@@ -400,18 +385,18 @@ fn find_package_root(from: &Path) -> Result<PathBuf> {
400385 // Canonicalize the path. This will resolve any intermediate links.
401386 let mut path = canonicalize ( from)
402387 . map_err ( |cause| Error :: chain ( format ! ( "Failed to canonicalize path {:?}." , from) , cause) ) ?;
403- debugln ! ( "find_package_root: canonicalized to {:?}" , path) ;
388+ log :: debug !( "canonicalized to {:?}" , path) ;
404389
405390 // Look up the device at the current path. This information will then be
406391 // used to stop at filesystem boundaries.
407392 #[ cfg( unix) ]
408393 let limit_rdev: Option < _ > = metadata ( & path) . map ( |m| m. dev ( ) ) . ok ( ) ;
409394 #[ cfg( unix) ]
410- debugln ! ( "find_package_root: limit rdev = {:?}" , limit_rdev) ;
395+ log :: debug !( "limit rdev = {:?}" , limit_rdev) ;
411396
412397 // Step upwards through the path hierarchy.
413398 for _ in 0 ..100 {
414- debugln ! ( "find_package_root: looking in {:?}" , path) ;
399+ log :: debug !( "looking in {:?}" , path) ;
415400
416401 // Check if we can find a package manifest here.
417402 if path. join ( "Bender.yml" ) . exists ( ) {
@@ -430,7 +415,7 @@ fn find_package_root(from: &Path) -> Result<PathBuf> {
430415 #[ cfg( unix) ]
431416 {
432417 let rdev: Option < _ > = metadata ( & path) . map ( |m| m. dev ( ) ) . ok ( ) ;
433- debugln ! ( "find_package_root: rdev = {:?}" , rdev) ;
418+ log :: debug !( "rdev = {:?}" , rdev) ;
434419 if rdev != limit_rdev {
435420 return Err ( Error :: new ( format ! (
436421 "No manifest (`Bender.yml` file) found. Stopped searching at filesystem boundary {:?}." ,
@@ -449,7 +434,7 @@ fn find_package_root(from: &Path) -> Result<PathBuf> {
449434pub fn read_manifest ( path : & Path ) -> Result < Manifest > {
450435 use crate :: config:: PartialManifest ;
451436 use std:: fs:: File ;
452- debugln ! ( "read_manifest: {:?}" , path) ;
437+ log :: debug !( "reading manifest {:?}" , path) ;
453438 let file = File :: open ( path)
454439 . map_err ( |cause| Error :: chain ( format ! ( "Cannot open manifest {:?}." , path) , cause) ) ?;
455440 let partial: PartialManifest = serde_yaml_ng:: from_reader ( file)
@@ -471,14 +456,14 @@ fn load_config(from: &Path, warn_config_loaded: bool) -> Result<Config> {
471456 // Canonicalize the path. This will resolve any intermediate links.
472457 let mut path = canonicalize ( from)
473458 . map_err ( |cause| Error :: chain ( format ! ( "Failed to canonicalize path {:?}." , from) , cause) ) ?;
474- debugln ! ( "load_config: canonicalized to {:?}" , path) ;
459+ log :: debug !( "canonicalized to {:?}" , path) ;
475460
476461 // Look up the device at the current path. This information will then be
477462 // used to stop at filesystem boundaries.
478463 #[ cfg( unix) ]
479464 let limit_rdev: Option < _ > = metadata ( & path) . map ( |m| m. dev ( ) ) . ok ( ) ;
480465 #[ cfg( unix) ]
481- debugln ! ( "load_config: limit rdev = {:?}" , limit_rdev) ;
466+ log :: debug !( "limit rdev = {:?}" , limit_rdev) ;
482467
483468 // Step upwards through the path hierarchy.
484469 for _ in 0 ..100 {
@@ -487,7 +472,7 @@ fn load_config(from: &Path, warn_config_loaded: bool) -> Result<Config> {
487472 out = out. merge ( cfg) ;
488473 }
489474
490- debugln ! ( "load_config: looking in {:?}" , path) ;
475+ log :: debug !( "looking in {:?}" , path) ;
491476
492477 if let Some ( cfg) = maybe_load_config ( & path. join ( ".bender.yml" ) , warn_config_loaded) ? {
493478 out = out. merge ( cfg) ;
@@ -502,7 +487,7 @@ fn load_config(from: &Path, warn_config_loaded: bool) -> Result<Config> {
502487 #[ cfg( unix) ]
503488 {
504489 let rdev: Option < _ > = metadata ( & path) . map ( |m| m. dev ( ) ) . ok ( ) ;
505- debugln ! ( "load_config: rdev = {:?}" , rdev) ;
490+ log :: debug !( "rdev = {:?}" , rdev) ;
506491 if rdev != limit_rdev {
507492 break ;
508493 }
@@ -551,7 +536,7 @@ fn load_config(from: &Path, warn_config_loaded: bool) -> Result<Config> {
551536/// Load a configuration file if it exists.
552537fn maybe_load_config ( path : & Path , warn_config_loaded : bool ) -> Result < Option < PartialConfig > > {
553538 use std:: fs:: File ;
554- debugln ! ( "maybe_load_config: {:?}" , path) ;
539+ log :: debug !( "maybe loading config {:?}" , path) ;
555540 if !path. exists ( ) {
556541 return Ok ( None ) ;
557542 }
@@ -570,7 +555,7 @@ fn maybe_load_config(path: &Path, warn_config_loaded: bool) -> Result<Option<Par
570555
571556/// Execute a plugin.
572557fn execute_plugin ( sess : & Session , plugin : & str , args : & [ String ] ) -> Result < ( ) > {
573- debugln ! ( "main: execute plugin `{}`" , plugin) ;
558+ log :: debug !( "execute plugin `{}`" , plugin) ;
574559
575560 // Obtain a list of declared plugins.
576561 let runtime = Runtime :: new ( ) ?;
@@ -582,7 +567,7 @@ fn execute_plugin(sess: &Session, plugin: &str, args: &[String]) -> Result<()> {
582567 Some ( p) => p,
583568 None => return Err ( Error :: new ( format ! ( "Unknown command `{}`." , plugin) ) ) ,
584569 } ;
585- debugln ! ( "main: found plugin {:#?}" , plugin) ;
570+ log :: debug !( "found plugin {:#?}" , plugin) ;
586571
587572 // Assemble a command that executes the plugin with the appropriate
588573 // environment and forwards command line arguments.
@@ -601,7 +586,7 @@ fn execute_plugin(sess: &Session, plugin: &str, args: &[String]) -> Result<()> {
601586 cmd. current_dir ( sess. root ) ;
602587 cmd. args ( args) ;
603588
604- debugln ! ( "main: executing plugin {:#?}" , cmd) ;
589+ log :: debug !( "executing plugin {:#?}" , cmd) ;
605590 let stat = cmd. status ( ) . map_err ( |cause| {
606591 Error :: chain (
607592 format ! (
0 commit comments