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 (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