Skip to content

Commit f45dc1c

Browse files
committed
logging: added sceonds to log_cmd if a command takes more than 5 seconds
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 17fcb97 commit f45dc1c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

flow/scripts/util.tcl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
proc log_cmd {cmd args} {
22
# log the command, escape arguments with spaces
3-
puts "$cmd [join [lmap arg $args {expr {[string match {* *} $arg] ? "\"$arg\"" : $arg}}] " "]"
3+
puts -nonewline "$cmd[join [lmap arg $args {expr {[string match {* *} $arg] ? " \"$arg\"" : " $arg"}}] ""]"
4+
set start [clock seconds]
45
$cmd {*}$args
6+
set time [expr {[clock seconds] - $start}]
7+
if {$time >= 5} {
8+
puts -nonewline " ($time seconds)"
9+
}
10+
puts ""
511
}
612

713
proc fast_route {} {

0 commit comments

Comments
 (0)