Opened 8 years ago

Closed 8 years ago

#5650 closed Bug (fixed)

Make log timestamp format configurable

Reported by: trajano Owned by:
Priority: Normal Milestone: 2.83
Component: Transmission Version: 2.82
Severity: Normal Keywords: patch
Cc:

Description

In https://trac.transmissionbt.com/browser/trunk/libtransmission/log.c#L162

The timestamp is hardcoded, please make it configurable or allow date information to be written out so it can be processed by log processing tools with the full date (and ideally timezone) information.

Attachments (1)

5650-date-and-tz-in-log.patch (558 bytes) - added by mike.dld 8 years ago.
Add date and timezone to log timestamp

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by mike.dld

Add date and timezone to log timestamp

comment:1 Changed 8 years ago by mike.dld

  • Keywords patch added

Log timestamp has been like that since its very beginning (r3295).

Since GTK+ and Mac clients use in-memory libtransmission's log queue to retrieve messages and don't parse the log file itself, the change seems trivial (to me). Please review the patch attached.

comment:2 Changed 8 years ago by mike.dld

Not sure whether %Z (timezone name) would be better than %z (timezone offset), but I have a slight preference for the former.

comment:3 Changed 8 years ago by jordan

Overall I'm fine with the idea of changing the format s.t. it can be parsed and processed.

Two points:

  • It's slightly cleaner to use the standard "%F %T" instead of spelling out the format
  • About %Z vs %z, I have a slight preference for the latter ;) as it's easier to parse things into UTC without dependency on some tool that knows timezone names. In the context of this ticket, though, I'm not sure why either is useful?

comment:4 Changed 8 years ago by jordan

  • Milestone changed from None Set to 2.83

comment:5 Changed 8 years ago by mike.dld

My man 3 strftime says that %T is an extension to C90, and MS implementation doesn't seem to even support %F.

As for %Z/%z (BTW, %z is also said to be an extension), I think name is friendlier to users while numeric offset is friendlier to scripts (as you noted). Maybe we could print both, but I do not insist. In general, you don't need timezone most of the time if you know that the time is local, but I was thinking of support cases where you might want to compare two or more logs (some not being written by Transmission itself).

comment:6 Changed 8 years ago by jordan

Hm, TIL. %F is c99, I'm surprised MS doesn't support it. Okay, agreed let's take the portable route.

comment:7 Changed 8 years ago by jordan

  • Resolution set to fixed
  • Status changed from new to closed

Patched with portable format strings and %Z in r14267.

Note: See TracTickets for help on using tickets.