unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Error reporting
@ 2008-11-21  6:36 Sebastian Tennant
  2008-11-22 23:30 ` Jon Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sebastian Tennant @ 2008-11-21  6:36 UTC (permalink / raw)
  To: guile-user

Hi all,

I very much doubt it's possible, but is there any way of getting Guile
to include a timestamp in it's error reporting?

For example:

 guile> foo
 2008-11-20 23:17:11 ERROR: Unbound variable: foo
 2008-11-20 23:17:11 ABORT: (unbound-variable)

Sebastian





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Error reporting
  2008-11-21  6:36 Error reporting Sebastian Tennant
@ 2008-11-22 23:30 ` Jon Wilson
  2008-11-23  6:18   ` Sebastian Tennant
  2008-11-23 11:48 ` Neil Jerram
  2008-11-23 12:29 ` Ludovic Courtès
  2 siblings, 1 reply; 8+ messages in thread
From: Jon Wilson @ 2008-11-22 23:30 UTC (permalink / raw)
  To: Sebastian Tennant; +Cc: guile-user

If this is added, I'd very much recommend including a way to turn it off 
(or more likely to turn it on), as extra noise in error messages 
generally comes at the price of quick understanding.  Most of the time, 
timestamps aren't needed, so, except when they are, they are noise.

Sebastian Tennant wrote:
> Hi all,
> 
> I very much doubt it's possible, but is there any way of getting Guile
> to include a timestamp in it's error reporting?
> 
> For example:
> 
>  guile> foo
>  2008-11-20 23:17:11 ERROR: Unbound variable: foo
>  2008-11-20 23:17:11 ABORT: (unbound-variable)
> 
> Sebastian
> 
> 
> 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Error reporting
  2008-11-22 23:30 ` Jon Wilson
@ 2008-11-23  6:18   ` Sebastian Tennant
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Tennant @ 2008-11-23  6:18 UTC (permalink / raw)
  To: guile-user

Quoth Jon Wilson <jsw@wilsonjc.us>:
> If this is added, I'd very much recommend including a way to turn it
> off (or more likely to turn it on), as extra noise in error messages
> generally comes at the price of quick understanding.  Most of the
> time, timestamps aren't needed, so, except when they are, they are
> noise.

Of course.  I was hoping for an environment variable which would need to
be set, something like GUILE_ERROR_TIMESTAMPS_ON.

Guile is my web application scripting language of choice.  As a result,
I have dozens of scripts that can be called at any given moment and any
Guile errors appear in my webserver's error log.  If Guile errors
included a timestamp, I'd be able to tell which page, and therefore
which script, caused the error, by conslting the access logs (which
already include timestamp information).

I can of course configure my webserver so that it writes one log per
domain, which will help, but error timestamps would be the ultimate
solution.

Sebastian





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Error reporting
  2008-11-21  6:36 Error reporting Sebastian Tennant
  2008-11-22 23:30 ` Jon Wilson
@ 2008-11-23 11:48 ` Neil Jerram
  2008-11-23 12:29 ` Ludovic Courtès
  2 siblings, 0 replies; 8+ messages in thread
From: Neil Jerram @ 2008-11-23 11:48 UTC (permalink / raw)
  To: Sebastian Tennant; +Cc: guile-user

2008/11/21 Sebastian Tennant <sebyte@smolny.plus.com>:
> Hi all,
>
> I very much doubt it's possible, but is there any way of getting Guile
> to include a timestamp in it's error reporting?
>
> For example:
>
>  guile> foo
>  2008-11-20 23:17:11 ERROR: Unbound variable: foo
>  2008-11-20 23:17:11 ABORT: (unbound-variable)

How about a soft output port that automatically adds a timestamp when
something is written to it?

You could implement a basic version of this very quickly - outputting
a timestamp whenever the port's display proc is called.  But that
might generate more timestamps than are useful, and not always at line
breaks.  So you could then get more sophisticated by

- scanning what is being output for a linebreak, and inserting the
timestamp there

- only inserting a timestamp if it has changed since the last one that
was output.

Then your web server would create one of these ports, and use it as
its error port.

Regards,
   Neil




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Error reporting
  2008-11-21  6:36 Error reporting Sebastian Tennant
  2008-11-22 23:30 ` Jon Wilson
  2008-11-23 11:48 ` Neil Jerram
@ 2008-11-23 12:29 ` Ludovic Courtès
  2008-11-26 17:16   ` Sebastian Tennant
  2 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2008-11-23 12:29 UTC (permalink / raw)
  To: guile-user

Hi,

Sebastian Tennant <sebyte@smolny.plus.com> writes:

> I very much doubt it's possible, but is there any way of getting Guile
> to include a timestamp in it's error reporting?
>
> For example:
>
>  guile> foo
>  2008-11-20 23:17:11 ERROR: Unbound variable: foo
>  2008-11-20 23:17:11 ABORT: (unbound-variable)

I like Neil's idea of using a soft output port to deal with that.

Another way would be to enclose web scripts in a `lazy-catch' whose
handler displays errors in an arbitrarily nice way: adding a timestamp,
showing the stack trace, etc.

Thanks,
Ludo'.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Error reporting
  2008-11-23 12:29 ` Ludovic Courtès
@ 2008-11-26 17:16   ` Sebastian Tennant
  2008-12-01 22:34     ` Neil Jerram
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Tennant @ 2008-11-26 17:16 UTC (permalink / raw)
  To: guile-user

Thanks for the suggestions guys.

I was already using soft output ports for writing controlled debugging
information to log files, and it never occurred to me to simply add:

 (set-current-error-port <macro-returning-port-to-/usr/bin/logger>)

to the top of my scripts!

Incidentally, I've written a module that wraps /usr/bin/logger and a
couple of macros that make defining any number of log functions a snip.

Example usage:

 In cgi/my-script.scm...

 (use-modules (sebyte glog))
 (load "lib/loggers.scm")         ;prepare log functions (names, log
                                  ;files, priorities, port tags, padding)

 (quick-loggers "my-script.scm")  ;define log functions with entry tag
                                  ;'my-script.scm'

 (info "foo")                     ;write to log file at priority info
 (alert "bar")                    ;write to log file at priority alert
 .
 .
 .
 
 Later on, in cgi/sub-script.scm...

 (quick-loggers "sub-script.scm") ;redefine log functions with entry tag
                                  ;'sub-script.scm'
 .
 .
 .


Is this the sort of thing that might go down well on guile.sources?

Seb





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Error reporting
  2008-11-26 17:16   ` Sebastian Tennant
@ 2008-12-01 22:34     ` Neil Jerram
  2008-12-02  5:48       ` Sebastian Tennant
  0 siblings, 1 reply; 8+ messages in thread
From: Neil Jerram @ 2008-12-01 22:34 UTC (permalink / raw)
  To: Sebastian Tennant; +Cc: guile-user

2008/11/26 Sebastian Tennant <sebyte@smolny.plus.com>:

> Is this the sort of thing that might go down well on guile.sources?

Yes!

(What else would guile.sources be for?)

      Neil




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Error reporting
  2008-12-01 22:34     ` Neil Jerram
@ 2008-12-02  5:48       ` Sebastian Tennant
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Tennant @ 2008-12-02  5:48 UTC (permalink / raw)
  To: guile-user

Quoth "Neil Jerram" <neiljerram@googlemail.com>:
> 2008/11/26 Sebastian Tennant <sebyte@smolny.plus.com>:
>
>> Is this the sort of thing that might go down well on guile.sources?
>
> Yes! (What else would guile.sources be for?)

I suppose what I was/am really asking is whether anyone actually reads
guile.sources... but how are you to know that... OK, point taken.  It
was a silly question.

Seb





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-12-02  5:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21  6:36 Error reporting Sebastian Tennant
2008-11-22 23:30 ` Jon Wilson
2008-11-23  6:18   ` Sebastian Tennant
2008-11-23 11:48 ` Neil Jerram
2008-11-23 12:29 ` Ludovic Courtès
2008-11-26 17:16   ` Sebastian Tennant
2008-12-01 22:34     ` Neil Jerram
2008-12-02  5:48       ` Sebastian Tennant

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 read-only IMAP folder(s) and NNTP newsgroup(s).