observe(3tk)
β¨ observe β like, runtime debugging output but make it TkCon π
okay bestie, this page lives in section 3tk of the manual, and it's literally the glow-up your debugging sessions have been waiting for π¦
π NAME π
observe β runtime debugging output in TkCon. no cap, that's the whole vibe π
πΈ SYNOPSIS πΈ
observe command cmdname ?maxlevel?
observe cdelete cmdname
observe cinfo cmdname
observe variable varname operation ?args?
observe vdelete varname operation
observe vinfo varname
π DESCRIPTION π
so this command gives you runtime debugging output for your variables AND your commands, and the way it does it means you never have to go edit your actual code. iconic behaviour honestly πβ¨
for variables, the underlying mechanism uses trace and dump var. for commands, it renames the procedure you're observing and wraps a special wrapper procedure around it. it's giving sneaky but make it useful π
β οΈ WARNING, bestie, for real: using this procedure after checkpointing state will result in major problems if you clean state, because the renamed (true) commands will be lost. not a vibe. read that twice π
this procedure is experimental. comments are encouraged β she's still in her testing era π§
observe command cmdname ?maxlevel?
this creates a wrapper command that prints out the call stack to the console (using dump). maxlevel is the max number of levels of the call stack that get printed, and it defaults to 4. lowkey a lot of levels, highkey very readable π
observe cdelete cmdname
removes the wrapper around an observed command. bye boo π
observe cinfo cmdname
prints out useless info. that's it. that's the description. she said what she said πβ¨
observe variable varname operation ?args?
currently a wrapper around trace that uses dump to print out the value of the named variable whenever the specified operation on that variable happens. operation must be read, write, or unset. three options, periodt π
observe vdelete varname operation
deletes the trace wrapper around the named variable. we're un-observing, respectfully π«Ά
observe vinfo varname
prints out trace info about the named variable. the receipts, basically π
π₯ SEE ALSO π₯
β KEYWORDS β
Tk, console, debug π
π COPYRIGHT π
Copyright (c) Jeffrey Hobbs <jeff at hobbs.org>
and that's the whole page, bestie!! this lil doc is from TkCon 2.5 and lives as observe(3tk) πΈ go observe something and slay ππ¦β¨
π¦ where this page comes from
- debian bookworm: tkcon 2:2.7.11-1
- debian trixie: tkcon 2:2.7.11-6
- ubuntu jammy: tkcon 2:2.7.10-2
- ubuntu noble: tkcon 2:2.7.11-1
- ubuntu resolute: tkcon 2:2.7.11-6
- ubuntu stonking: tkcon 2:2.7.11-6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms