k-mktr commited on
Commit
2b882cc
·
verified ·
1 Parent(s): 10384e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -26,18 +26,20 @@ from release_notes import get_release_notes_html
26
  # Update the logging format to redact URLs
27
  logging.basicConfig(
28
  level=logging.INFO,
29
- format='%(asctime)s - %(levelname)s - %(message)s',
30
- filters=[lambda s: s.replace(config.API_URL, '[REDACTED]') if config.API_URL in s else s]
31
  )
32
- logger = logging.getLogger(__name__)
33
- # Add this at the top with other imports
34
  class RedactURLsFilter(logging.Filter):
35
  def filter(self, record):
 
 
36
  record.msg = record.msg.replace(config.NEXTCLOUD_URL, '[CLOUD_STORAGE]')
37
- return super().filter(record)
38
 
39
- # Apply the filter to all loggers
40
- logging.getLogger().addFilter(RedactURLsFilter())
 
 
41
 
42
  # Start the backup thread
43
  start_backup_thread()
 
26
  # Update the logging format to redact URLs
27
  logging.basicConfig(
28
  level=logging.INFO,
29
+ format='%(asctime)s - %(levelname)s - %(message)s'
 
30
  )
31
+
 
32
  class RedactURLsFilter(logging.Filter):
33
  def filter(self, record):
34
+ # Redact both API URL and Nextcloud URL
35
+ record.msg = record.msg.replace(config.API_URL, '[API_ENDPOINT]')
36
  record.msg = record.msg.replace(config.NEXTCLOUD_URL, '[CLOUD_STORAGE]')
37
+ return True
38
 
39
+ # Apply the filter to all handlers
40
+ logger = logging.getLogger(__name__)
41
+ for handler in logging.root.handlers:
42
+ handler.addFilter(RedactURLsFilter())
43
 
44
  # Start the backup thread
45
  start_backup_thread()