Feature Request: Current time in traceback

T

Thomas Guettler

Hi,

I think it would be good, if the current time
would be in the traceback.

This would make it easier to read logfiles with
tracebacks of python scripts.

I know that I can write a custom exception handler,
but why not make it the default?

Regards,
Thomas
 
P

Peter Hansen

Thomas said:
I think it would be good, if the current time
would be in the traceback.

This would make it easier to read logfiles with
tracebacks of python scripts.

I know that I can write a custom exception handler,
but why not make it the default?

Two thoughts on why not:

1. Most loggers already write the timestamp before *anything*
that is written, so this would be duplicated information.
(Actually, I'm curious what logfile you have that *doesn't*
have this info already.)

2. This is the first time I've heard anyone suggest that
it's a common use case to actually want the traceback
to contain a timestamp. I think normally tracebacks are
examined immediately when a human is present. When they
are logged and it might be important to know the time, see 1.

-Peter
 
J

Jeff Epler

In your application, you can use a top-level exception handler or
set sys.excepthook to override the default way that exceptions are
displayed. One example of this (which formats exceptions as HTML) is
the standard module "cgitb".

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBJrSnJd01MZaTXX0RAuzfAJwOW3u1HVsbGNBn89MN/7Ml+MfldgCfTNW1
ZR0Z2fArG/NUda7Vm8XRb60=
=KGu8
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top