Posted to tcl by Bradipo at Tue Jul 23 17:19:57 GMT 2024view pretty
proc fmtdate {s} { clock format $s -format {%Y-%m-%d %T: } } proc fmtlevel {l} { format "%7s" $l } proc fmtlog {l} { format ": %s" $l } set f [frame .f] set t [text $f.t -setgrid 1 -wrap word -height 24 -width 80] $t tag configure log -lmargin2 .5i -rmargin .128i -lmargincolor red -rmargincolor green $t tag configure level -foreground blue $t tag configure datetime -foreground slategrey pack $f -expand y pack $t -expand y $t insert end [fmtdate [clock seconds]] datetime [fmtlevel "urgent"] level [fmtlog [join [lrepeat 5 {These are some words to try.}] { }]\n] log $t insert end [fmtdate [clock seconds]] datetime [fmtlevel "urgent"] level [fmtlog [join [lrepeat 5 {And these are some other words to try.}] { }]\n] log