zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Paul Lew <paullew@cisco.com>, zsh-users@sunsite.auc.dk
Subject: Re: zsh debug tracing with timestamp
Date: Sun, 15 Apr 2001 19:49:43 +0000	[thread overview]
Message-ID: <1010415194943.ZM11223@candle.brasslantern.com> (raw)
In-Reply-To: <15065.17386.300246.739496@paullew-ultra.cisco.com>

On Apr 14, 11:47pm, Paul Lew wrote:
} Subject: zsh debug tracing with timestamp
}
} Any method to insert timestamp in front of the trace command turned on
} by set -x?

Yes, if you're using 3.1.6 or later.  Just set PS4 using any of the usual
prompt expansion escapes, e.g.:

% PS4=': %D %T ; '
% set -x
% sleep 5; echo hello
: 01-04-15 12:43 ; sleep 5
: 01-04-15 12:43 ; echo hello
hello

If you need finer granularity, setopt promptsubst and use $SECONDS:

% setopt promptsubst
: 01-04-15 12:44 ; setopt promptsubst
% PS4=': %D %T {$SECONDS}; '
: 01-04-15 12:44 ; PS4=: %D %T {$SECONDS};  
% sleep 5; echo hello
: 01-04-15 12:45 {261}; sleep 5
: 01-04-15 12:45 {266}; echo hello
hello

One-second granularity is the smallest you can get.

I chose the :...; format so that you can cut-and-paste the trace output
into another shell and the leading timestamps will be ignored.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2001-04-15 19:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-15  6:47 Paul Lew
2001-04-15 19:49 ` Bart Schaefer [this message]
2001-04-15 20:22   ` Dan Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010415194943.ZM11223@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=paullew@cisco.com \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).