I've attached a patch that implements logging with a new command,
log-pane or logp.  A -b flag will begin logging for the pane, -e will
end it, and -o will toggle it on/off, similar to pipe-pane.  You can
specify the filename with -f, but if you don't, there's a default
that's set to "~/tmux-#S-#I-#P.log" with a logpane-default-logname
session option.

Logging can be made to happen automatically when a new pane is created
by setting the session option logpane-autolog to 1.  It defaults to
off, though.

In order to allow things like #S and #P in the filename I had to alter
status_replace().  That function required a non-NULL client variable,
which won't always be available when setting the filename.  I altered
it so that it will accept a NULL client.  If client is non-NULL, it'll
behave as before.  With a NULL, it'll use s, wl, and wp to replace
what it can.

I also added a function to cmd-string.c called
cmd_string_expand_path().  This expands a tilde or $var in the
filename.  While cmd_string_parse() can do this, it leads to odd
quoting needs in conjunction with the status formatting.  If you enter
~/file-#P (no quotes), then the #P gets chopped off because it's
assumed to start a comment.  If you enter "~/file-#P" then
cmd_string_parse() won't expand the tilde.  You'd have to get around
it by doing ~/file-"#P".

With the patch, each pane gets a logging filename and file descriptor,
initially set to NULL and -1.  Only when logging is turned on for the
pane will the filename be set, and fd set to the return from open().

Attachment: log-pane.patch
Description: Binary data

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to