(trace) formatting changed when more than one arg passed

This commit is contained in:
Sitaram Chamarty 2012-03-11 09:26:12 +05:30
parent 56cda99edd
commit 17476318b9

View file

@ -39,10 +39,11 @@ sub say2 {
sub trace { sub trace {
return unless defined( $ENV{D} ); return unless defined( $ENV{D} );
my $level = shift; my $level = shift; return if $ENV{D} < $level;
my $args = ''; $args = join( ", ", @_ ) if @_; my $args = ''; $args = join( ", ", @_ ) if @_;
my $sub = ( caller 1 )[3] || ''; $sub =~ s/.*://; $sub .= ' ' x ( 32 - length($sub) ); my $sub = ( caller 1 )[3] || ''; $sub =~ s/.*://; $sub .= ' ' x ( 32 - length($sub) );
say2 "TRACE $level $sub", $args if $ENV{D} >= $level; say2 "TRACE $level $sub", (@_ ? shift : ());
say2("TRACE $level " . (" " x 32), $_)for @_;
} }
sub dbg { sub dbg {