File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 11[pytest]
2+ pythonpath = src
23markers =
34 external: run tests which requires external tools
Original file line number Diff line number Diff line change @@ -186,20 +186,21 @@ def __init__(
186186 datefmt : Optional [str ] = None ,
187187 defaults : Optional [Dict [str , str ]] = None ,
188188 ):
189+ super ().__init__ ("%(message)s" , datefmt )
189190 self .keys = [self .normalize_key (key ) for key in keys ]
190191 self .mapping = {
191192 self .normalize_key (key ): value for key , value in mapping .items ()
192193 }
193- self .datefmt = datefmt
194194 self .defaults = {
195195 key : _DefaultFormatter (value , style = "{" )
196196 for key , value in (defaults or {}).items ()
197197 }
198198
199199 def format (self , record : logging .LogRecord ) -> str :
200200 # If the 'asctime' attribute will be used, then generate it.
201- if "asctime" in self .keys or "asctime" in self .mapping .values ():
202- record .asctime = self .formatTime (record , self .datefmt )
201+ if not hasattr (record , "asctime" ):
202+ if "asctime" in self .keys or "asctime" in self .mapping .values ():
203+ record .asctime = self .formatTime (record , self .datefmt )
203204
204205 if isinstance (record .msg , dict ):
205206 params = self .flatten_dict (record .msg )
You can’t perform that action at this time.
0 commit comments