[ python-Feature Requests-1006786 ] extend strptime to understand logging timestamps

SourceForge.net noreply at sourceforge.net
Wed Aug 11 03:43:19 CEST 2004


Feature Requests item #1006786, was opened at 2004-08-10 11:59
Message generated for change (Comment added) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1006786&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Brett Cannon (bcannon)
Summary: extend strptime to understand logging timestamps

Initial Comment:
The default timestamp format used by the logging module
appends
a comma followed by a three-digit value representing
milliseconds,
e.g.:

    2004-08-10 08:21:20,380 DEBUG <mytag> log message here

It would be nice if time.strptime() grokked this
specification for
the seconds in a timestamp so that applications which
want to
analyze log files can do so more easily.  One
possibility is to
add a %s format specifier which recognizes NN,MMM as a
floating point value containing fractional seconds with
a comma
as the "decimal point".

Attached is a simple patch.  I chose %s as the format
sequence
since it is related to %S.


----------------------------------------------------------------------

>Comment By: Brett Cannon (bcannon)
Date: 2004-08-10 18:43

Message:
Logged In: YES 
user_id=357491

Is this the best solution, or would it be better to just have a specific 
logging module directive (either in the logging package or in strptime) 
that recognized the whole string?  If that format *never* changes, then 
we could just simplify it by having a single directive to make life easier 
for everyone involved.

If we are going to compromise on adding a special directive for the 
logging module might as well go all the way, right?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1006786&group_id=5470


More information about the Python-bugs-list mailing list