L'url est https://www.g33k-zone.org/index.php?post...%A9-en-TCL
La source:
Utilisation (exemple):
La source:
tcl
namespace eval d {
variable levels {"error" "warning" "notice" "debug" "info" "success"}
foreach {name value} {r 1 g 2 b 4 c 6 m 5 y 3} {
proc $name {} "return \033\\\[01\\;3${value}m"
proc [string toupper $name] {} "return \033\\\[01\\;4${value}m"
}
proc n {} {return \033\[\;0m}
proc puts {text {level ""}} {
switch -nocase $level {
"error" { ::puts "[r]$text[n]" }
"warning" { ::puts "[y]$text[n]" }
"notice" { ::puts "[c]$text[n]" }
"debug" { ::puts "[m]$text[n]" }
"info" { ::puts "[b]$text[n]" }
"success" { ::puts "[g]$text[n]" }
default { ::puts "$text" }
}
}
}
Utilisation (exemple):
tcl
#/usr/bin/tclsh
source debugger.tcl
foreach level $::d::levels {
::d::puts "Level is set to $level" $level
}