mirror of
https://github.com/Dielee/volvo2mqtt.git
synced 2026-08-10 09:49:52 +02:00
Allow multiple vcc api keys (#85)
* Multiple vccapikeys function * Reduce api calls for key checks * Change sleeptime * Optimize logging * Format log datetime * Change default conf * Set device offline, if no working vcc api key can be found * Fix climate scheduler * Only redact sensitive data if debug is enabled
This commit is contained in:
+7
-4
@@ -13,7 +13,8 @@ from pathlib import Path
|
||||
TZ = None
|
||||
SENSITIVE_PATTERNS = [
|
||||
r"[A-Z0-9]{17}", # VIN
|
||||
r"\d{1,2}\.\d{5,16}" # Location
|
||||
r"\d{1,2}\.\d{5,16}", # Location
|
||||
r"[a-z0-9]{32}" # VCCAPIKEY
|
||||
]
|
||||
|
||||
|
||||
@@ -48,13 +49,15 @@ def setup_logging():
|
||||
'%(asctime)s volvo2mqtt [%(process)d] - %(levelname)s: %(message)s',
|
||||
'%b %d %H:%M:%S')
|
||||
file_log_handler.setFormatter(formatter)
|
||||
sensitive_data_filter = SensitiveDataFilter(SENSITIVE_PATTERNS)
|
||||
file_log_handler.addFilter(sensitive_data_filter)
|
||||
logger = logging.getLogger()
|
||||
|
||||
if settings["debug"]:
|
||||
sensitive_data_filter = SensitiveDataFilter(SENSITIVE_PATTERNS)
|
||||
file_log_handler.addFilter(sensitive_data_filter)
|
||||
|
||||
console_log_handler = logging.StreamHandler(sys.stdout)
|
||||
console_log_handler.setFormatter(formatter)
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.addHandler(console_log_handler)
|
||||
logger.addHandler(file_log_handler)
|
||||
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
||||
|
||||
Reference in New Issue
Block a user