Within a proc can you get the proc name (without hardcoding it)? e.g.
proc my_proc { some_arg } {
puts "entering proc [some way of getting proc name]"
}
Of course you can!
Use info level
command:
proc my_proc { some_arg } {
puts "entering proc [lindex [info level 0] 0]"
}
and you get exactly what you want
entering proc my_proc
Another way is to use info frame
, which gives a dictionary with some other info, and read the proc
key:
proc my_proc { some_arg } {
puts "entering proc [dict get [info frame 0] proc]"
}
this time, you'll get the fully qualified proc name:
entering proc ::my_proc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With