@@ -131,17 +131,16 @@ def format(self, record: logging.LogRecord) -> str: # noqa: A003
131
131
return self .json_serializer (formatted_log )
132
132
133
133
def formatTime (self , record : logging .LogRecord , datefmt : Optional [str ] = None ) -> str :
134
- # NOTE: Pyhton time.strftime doesn't provide msec directives
135
- # so we create a custom one (%F) and replace logging record ts
136
- # Reason 2 is that std logging doesn't support msec after TZ
137
134
record_ts = self .converter (record .created )
138
135
if datefmt :
139
- ts_formatted = time .strftime (datefmt , record_ts )
140
- else :
141
- msec = "%03d" % record .msecs
142
- custom_fmt = self .default_time_format .replace (self .custom_ms_time_directive , msec )
143
- ts_formatted = time .strftime (custom_fmt , record_ts )
144
- return ts_formatted
136
+ return time .strftime (datefmt , record_ts )
137
+
138
+ # NOTE: Python `time.strftime` doesn't provide msec directives
139
+ # so we create a custom one (%F) and replace logging record ts
140
+ # Reason 2 is that std logging doesn't support msec after TZ
141
+ msecs = "%03d" % record .msecs
142
+ custom_fmt = self .default_time_format .replace (self .custom_ms_time_directive , msecs )
143
+ return time .strftime (custom_fmt , record_ts )
145
144
146
145
def append_keys (self , ** additional_keys ):
147
146
self .log_format .update (additional_keys )
0 commit comments