The log function accepts a timestamp param which, if not provided, will get automatically populated with a UTC-based timestamp of the current time (via the datetime2rfc3339 function). If, however, the user provides this param with a datetime object, then any attached tzinfo is ignored, and that object is only correctly handled if the timestamp is in the recent past (less than 30 minutes ago).
If one provides a timestamp which is further in the past than a half hour from the current time, then an incorrect timezone offset is calculated, effectively making the timestamp itself incorrect in the resulting syslog message header.
If one replaces the contents of datetime2rfc3339 with return dt.isoformat(), I believe this will always produce a valid syslog timestamp (compared against the RFC document).