Alexander Burger <[email protected]> writes:
Hi Alex,
> How about this?
>
> (de log (File Funs . Prg)
> (err File
> (prog2
> (mapc trace Funs)
> (run Prg 1)
> (mapc untrace Funs) ) ) )
>
> It can be used like
>
> (log "+myLogFile" '(gt0 le0 + - * /)
> (myProgram
> (myFun
> (foo (bar ..)) ) ) )
>
> This example traces all calls to the comparison and arithmetic functions
> in the list while 'myProgram' is running.
>
> The "+" is to append the output to the log file. Without it, "myLogFile"
> will be overwritten from scratch each time.
Thanks, that is short but very generic, and much better than anything I
would have produced.
One question:
could it be used to optionally log a whole web-application by wrapping
the main function as 'myProgram' into the log function?
(de main ()
(call 'mkdir "-p" *Pool *Blob)
(pool *Pool *Dbs *Jnl)
(unless (seq *DB)
(load "app/init.l") ) ... )
(de logMain ()
(log ...
(main) ) )
and then start with
,-------------------------------
| : ./pil app/main.l -main -go +
`-------------------------------
or
,----------------------------------
| : ./pil app/main.l -logMain -go +
`----------------------------------
for turning logging off or on?
--
cheers,
Thorsten
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe