Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package provide tlog 1.0.0
- proc tlog {tags msg} {
- foreach b $tlog::black {
- if {-1!=[lsearch $tlog::match $tags $b]} {
- return; # tag was on black list, don't print
- }
- }
- foreach w $tlog::white {
- if {-1!=[lsearch $tlog::match $tags $w]} {
- tlog::print $tags [uplevel [list subst $msg]]; # tag was on white list, print and return
- return;
- }
- }
- }
- namespace eval tlog {
- proc white args { variable white {*}$args }; variable white *
- proc black args { variable black {*}$args }; variable black {}
- proc match args { variable match {*}$args }; variable match -glob
- proc print {tags msg} {
- puts stderr $msg
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement