File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ def __init__(self):
20
20
environment variable.
21
21
"""
22
22
super ().__init__ ()
23
- self .mode = os .getenv ('DEBUG_MODE_TOKEN_FILTER' , 'DEFAULT' ).upper ()
23
+ self .mode = os .getenv ('DEBUG_MODE_TOKEN_FILTER' , 'DEFAULT' ).upper ()
24
+ if self .mode == 'DEFAULT' :
25
+ msg = "Your logger, when in DEBUG mode, will log TOKENS"
26
+ raise Warning (msg )
24
27
25
28
def filter (self , record ):
26
29
"""
@@ -37,7 +40,4 @@ def filter(self, record):
37
40
record .msg = re .sub (r'Bearer (\w+)' , '[MASKED]' , record .getMessage ())
38
41
elif self .mode == "SUPPRESS" :
39
42
return False
40
- elif self .mode == "DEFAULT" :
41
- msg = "Your logger, when in DEBUG mode, will log TOKENS"
42
- raise Warning (msg )
43
- return True
43
+ return True # if mode is not MASKED then DEFAULT is implied
You can’t perform that action at this time.
0 commit comments