File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/DIRAC/FrameworkSystem/private/standardLogging/Formatter Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
import time
2
- from pythonjsonlogger .jsonlogger import JsonFormatter
2
+ from pythonjsonlogger .jsonlogger import JsonFormatter , RESERVED_ATTRS
3
3
4
4
5
5
class MicrosecondJsonFormatter (JsonFormatter ):
6
6
"""Standard JSON formater with microsecond precision"""
7
7
8
+ def __init__ (self , * args , ** kwargs ):
9
+ """
10
+ Add to the list of attributes we don't want to see
11
+ all the DIRAC spefic log formating instructions
12
+ """
13
+ if "reserved_attrs" not in kwargs :
14
+ kwargs ["reserved_attrs" ] = RESERVED_ATTRS + (
15
+ "spacer" ,
16
+ "headerIsShown" ,
17
+ "timeStampIsShown" ,
18
+ "contextIsShown" ,
19
+ "threadIDIsShown" ,
20
+ "color" ,
21
+ )
22
+ super ().__init__ (* args , ** kwargs )
23
+
8
24
def formatTime (self , record , datefmt = None ):
9
25
""":py:meth:`logging.Formatter.formatTime` with microsecond precision by default"""
10
26
ct = self .converter (record .created )
You can’t perform that action at this time.
0 commit comments