• 
      

    Add options and context manager support to log_timed().

    Review Request #14365 — Created March 12, 2025 and submitted — Latest diff uploaded

    Information

    Djblets
    release-5.x

    Reviewers

    log_timed() has been updated to take in an optional logger argument
    to specify a customer logger and extra 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.

    Commits

    Files