Add options and context manager support to log_timed().
Review Request #14365 — Created March 11, 2025 and submitted — Latest diff uploaded
log_timed()
has been updated to take in an optionallogger
argument
to specify a customer logger andextra
to populate additional log
fields.It also now works as a context manager, which handles stopping a log
when an exception occurs. This should simplify usage overall.Every
log_timed()
call has a trace ID that can be used to associate
the beginning/end/result logs together. This is exposed on the timer
object so that other log calls can include it in their logs.All arguments after
message
are now keyword-only. This will be
enforced in Djblets 7.Deprecated calls for datetimes have been fixed. Typing has been added.
Documentation has been modernized to meet current standards. Unit tests
were added.
Unit tests pass.
Diff Revision 2
This is not the most recent revision of the diff. The latest diff is revision 6. See what's changed.
Commits
djblets/log/__init__.py |
---|
djblets/log/tests/test_log_timed.py |
---|