Igor Schein on Sun, 4 May 2003 15:00:49 -0400

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: default log file

On Tue, Nov 13, 2001 at 04:59:49PM +0100, Karim BELABAS wrote:
> On Fri, 9 Nov 2001, Igor Schein wrote:
> > I have a suggestion to make a default log file to be pseudo-unique for
> > the session, for example pari<pid>.log.  This way you make a situation
> > where you're writing by mistake to the same pari.log file from 2
> > different machines much less likely to happen.
> The suggested setting in gprc.dft is
>   logfile = "~/tmp/pari-%d.%m"

The limitation here is that %d and %m are evaluated at the session
start, not at the point when \l is issued.  I often have a need to
start a separate log file for certain commands.  So,

> Well, you can always improve on that:
>   install(getpid, l)
>   default(logfile, Str("~/tmp/pari-%d.%m." getpid()))

I have to define a function:

setlog()=default(logfile, Str("~/tmp/pari-%a-%b-%d-%H-%M-%S-"getpid()))

which I can live with.

On a related subject:

? hostname()=extern("uname -n")
? hostname
  ***   unknown member function: puneet.txc.com

I can work around it:

? hostname()=extern("uname -n|cut -d. -f1")
? hostname

However, is there a way to prevent the immediate evaluation?