Would a logging framework make sense for PicoLisp

2014-02-25 Thread Thorsten Jolitz

Hi List, 

sometimes I start putting a lot of (maybe too many) 'msg calls in my
code for debugging purposes, what then triggers memories of logging
frameworks for Java I once read about. 

Would it make sense to add such a logging framework to the language as a
kind of third debugging tool (besides trace and debug)? I was thinking
about something along the line of

 - a new global variable *Log
 - two new functions 'log and 'unlog
 - an equivalent to ! as debugging breakpoint (e.g. § or whatever as
   logging point)

*Log would then be NIL or one of several logging levels
(e.g. 1,2,3). (log func) would then put § before all expressions of a
function, (unlog func) remove them. Depending on the logging level, §
would do nothing or, e.g., print the expression and the results of
what (e) and (d) do during debugging, and maybe all variables with
their actual values in that expression.

What do you think?

-- 
cheers,
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Patch: Exit status for call

2014-02-25 Thread Alexander Burger
On Tue, Feb 25, 2014 at 02:07:30AM +0200, Константин Бытенский wrote:
  Does anybody have objections against this? If not, I'll put it tomorrow
  into pil64, pil32 and Ersatz.

Done.
♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Would a logging framework make sense for PicoLisp

2014-02-25 Thread Henrik Sarvell
Sometimes it's also nice to be able to get everything in a file, not
just printed, would be nice if it could have that option.

On Tue, Feb 25, 2014 at 6:50 PM, Thorsten Jolitz tjol...@gmail.com wrote:

 Hi List,

 sometimes I start putting a lot of (maybe too many) 'msg calls in my
 code for debugging purposes, what then triggers memories of logging
 frameworks for Java I once read about.

 Would it make sense to add such a logging framework to the language as a
 kind of third debugging tool (besides trace and debug)? I was thinking
 about something along the line of

  - a new global variable *Log
  - two new functions 'log and 'unlog
  - an equivalent to ! as debugging breakpoint (e.g. § or whatever as
logging point)

 *Log would then be NIL or one of several logging levels
 (e.g. 1,2,3). (log func) would then put § before all expressions of a
 function, (unlog func) remove them. Depending on the logging level, §
 would do nothing or, e.g., print the expression and the results of
 what (e) and (d) do during debugging, and maybe all variables with
 their actual values in that expression.

 What do you think?

 --
 cheers,
 Thorsten

 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Would a logging framework make sense for PicoLisp

2014-02-25 Thread Joe Bogner
I like the idea of something simple and possibly built-in. However, would
it be possible to implement as a function that wraps definitions with a
redef and adds the logging?

http://software-lab.de/doc/refR.html#redef


On Tue, Feb 25, 2014 at 9:20 AM, Henrik Sarvell hsarv...@gmail.com wrote:

 Sometimes it's also nice to be able to get everything in a file, not
 just printed, would be nice if it could have that option.

 On Tue, Feb 25, 2014 at 6:50 PM, Thorsten Jolitz tjol...@gmail.com
 wrote:
 
  Hi List,
 
  sometimes I start putting a lot of (maybe too many) 'msg calls in my
  code for debugging purposes, what then triggers memories of logging
  frameworks for Java I once read about.
 
  Would it make sense to add such a logging framework to the language as a
  kind of third debugging tool (besides trace and debug)? I was thinking
  about something along the line of
 
   - a new global variable *Log
   - two new functions 'log and 'unlog
   - an equivalent to ! as debugging breakpoint (e.g. § or whatever as
 logging point)
 
  *Log would then be NIL or one of several logging levels
  (e.g. 1,2,3). (log func) would then put § before all expressions of a
  function, (unlog func) remove them. Depending on the logging level, §
  would do nothing or, e.g., print the expression and the results of
  what (e) and (d) do during debugging, and maybe all variables with
  their actual values in that expression.
 
  What do you think?
 
  --
  cheers,
  Thorsten
 
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe



Re: Would a logging framework make sense for PicoLisp

2014-02-25 Thread Henrik Sarvell
Yes AFAIK all of Thorsten's description should be possible to
implement without touching any code that needs to be compiled. So code
away, no need to ask Alex for anything! ;-)

On Tue, Feb 25, 2014 at 9:35 PM, Joe Bogner joebog...@gmail.com wrote:
 I like the idea of something simple and possibly built-in. However, would it
 be possible to implement as a function that wraps definitions with a redef
 and adds the logging?

 http://software-lab.de/doc/refR.html#redef


 On Tue, Feb 25, 2014 at 9:20 AM, Henrik Sarvell hsarv...@gmail.com wrote:

 Sometimes it's also nice to be able to get everything in a file, not
 just printed, would be nice if it could have that option.

 On Tue, Feb 25, 2014 at 6:50 PM, Thorsten Jolitz tjol...@gmail.com
 wrote:
 
  Hi List,
 
  sometimes I start putting a lot of (maybe too many) 'msg calls in my
  code for debugging purposes, what then triggers memories of logging
  frameworks for Java I once read about.
 
  Would it make sense to add such a logging framework to the language as a
  kind of third debugging tool (besides trace and debug)? I was thinking
  about something along the line of
 
   - a new global variable *Log
   - two new functions 'log and 'unlog
   - an equivalent to ! as debugging breakpoint (e.g. § or whatever as
 logging point)
 
  *Log would then be NIL or one of several logging levels
  (e.g. 1,2,3). (log func) would then put § before all expressions of a
  function, (unlog func) remove them. Depending on the logging level, §
  would do nothing or, e.g., print the expression and the results of
  what (e) and (d) do during debugging, and maybe all variables with
  their actual values in that expression.
 
  What do you think?
 
  --
  cheers,
  Thorsten
 
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe


--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Would a logging framework make sense for PicoLisp

2014-02-25 Thread Alexander Burger
On Tue, Feb 25, 2014 at 09:35:05AM -0500, Joe Bogner wrote:
 I like the idea of something simple and possibly built-in. However, would
 it be possible to implement as a function that wraps definitions with a
 redef and adds the logging?

This might possibly done with 'daemon'. Not really a wrap, as it adds
only to the beginning of a function, but if you want entry _and_ exit
info we have 'trace' already.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Would a logging framework make sense for PicoLisp

2014-02-25 Thread Alexander Burger
On Tue, Feb 25, 2014 at 05:01:21PM +0100, Alexander Burger wrote:
 One simple way is to use 'err' around your program to redirect standard
 error
 
(err myLog.txt
   (main) )
 
 and then use the normal 'trace' and 'msg' functions which print to
 standard error.

or, of course, start the whole program with redirection:

   $ pil myProgram.l ... -main ... +  2err
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Would a logging framework make sense for PicoLisp

2014-02-25 Thread Thorsten Jolitz
Alexander Burger a...@software-lab.de writes:

 On Tue, Feb 25, 2014 at 05:01:21PM +0100, Alexander Burger wrote:
 One simple way is to use 'err' around your program to redirect standard
 error
 
(err myLog.txt
   (main) )
 
 and then use the normal 'trace' and 'msg' functions which print to
 standard error.

 or, of course, start the whole program with redirection:

$ pil myProgram.l ... -main ... +  2err

but it would be nice to have a function pair (log and unlog) that does
all this: 

 - trace the function
 - redirect the output of trace to a file too
 - untrace and go back to default stderr

something like this

#+begin_src picolisp
  (de log (Func)
 (err (tmp log)
(trace Func)
(pass Func) ) )  
#+end_src

but this does not work unfortunately...

-- 
cheers,
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe