This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Console Window Logging.
- From: "Martin M. Hunt" <hunt at redhat dot com>
- To: duane_ellis at franklin dot com, insight at sources dot redhat dot com
- Date: Thu, 7 Mar 2002 16:15:11 -0800
- Subject: Re: Console Window Logging.
- Organization: Red Hat Inc
- References: <200203072303.SAA28226@mercury.franklin.com>
On Thursday 07 March 2002 03:03 pm, Duane Ellis wrote:
> Several people I support have asked me for a means by which to 'log
> the console window output' to a file. What I want is anything written
> to the TK Console window to go to *BOTH* the TK console window, and a
> file, ie: "foobar.log"
>
> How can I do this? {I cannot use the "-nw" option, I have
> to have tk/tcl operating in this situation}
>
> Isn't there some place in the tk/tcl code that deals with
> the console window where I can 'hack' this in?
>
> I need the ablity to turn this log ON and OFF
> from a typed command, something like:
>
> tk Console::LogToFile start foobar.log
> tk Console::LogToFile stop
>
> It seems that "Console::insert {line}" is the right place I know
> normal tcl/tk - this "itb/ith" stuff is funky and I'm abit confused,
> and I don't know how fiddle with this part.
We should really update the README. Insight is written in [incr tcl], which
is an OO version of tcl/tk. ith is an incr tcl header and itb is the body.
All classes are declared in ith files and the methods and procs are
implemented in itb files. You can actually edit console.itb while Insight is
running, then source the new console.itb file and open a new console window
to test it without ever exiting Insight. There is a convenient interface to
do this in the debug window menu. When you change the header, you must exit
and restart Insight. You should really use the debug window when developing.
What you describe should be very simple. Declare LogToFile as a public proc
in console.ith. Also pick a private variable to hold the filename.
Implement Console::LogToFile in console.itb. Modify insert to write to the
log file if one is defined.
--
Martin Hunt
GDB Engineer
Red Hat, Inc.