Refactor the logging facility a bit

This commit is contained in:
KnugiHK
2026-01-24 17:05:14 +08:00
parent 4eed3ca321
commit f920ca82b4
8 changed files with 123 additions and 121 deletions

View File

@@ -6,7 +6,6 @@ from Whatsapp_Chat_Exporter.data_model import ChatStore
from Whatsapp_Chat_Exporter.utility import Device
logger = logging.getLogger(__name__)
class ExportedContactNumbers(TypedDict):
@@ -45,7 +44,7 @@ def decode_quoted_printable(value: str, charset: str) -> str:
return bytes_val.decode(charset, errors="replace")
except Exception:
# Fallback: return the original value if decoding fails
logger.warning(
logging.warning(
f"Failed to decode quoted-printable value: {value}, "
f"charset: {charset}. Please report this issue."
)
@@ -176,7 +175,7 @@ def read_vcards_file(vcf_file_path, default_country_code: str):
if contact := process_vcard_entry(vcard):
contacts.append(contact)
logger.info(f"Imported {len(contacts)} contacts/vcards")
logging.info(f"Imported {len(contacts)} contacts/vcards")
return map_number_to_name(contacts, default_country_code)