mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 13:36:30 +03:00
Use tracing crate for logging
This commit is contained in:
@@ -95,6 +95,7 @@ class Account:
|
||||
ptr,
|
||||
lib.dc_context_unref,
|
||||
)
|
||||
self._id = lib.dc_get_id(self._dc_context)
|
||||
|
||||
self._shutdown_event = Event()
|
||||
self._event_thread = EventThread(self)
|
||||
@@ -139,6 +140,10 @@ class Account:
|
||||
"""return dictionary of built config parameters."""
|
||||
return get_dc_info_as_dict(self._dc_context)
|
||||
|
||||
def get_id(self) -> int:
|
||||
"""Return account ID."""
|
||||
return self._id
|
||||
|
||||
def dump_account_info(self, logfile):
|
||||
def log(*args, **kwargs):
|
||||
kwargs["file"] = logfile
|
||||
|
||||
@@ -263,6 +263,7 @@ class EventThread(threading.Thread):
|
||||
self._process_event(event)
|
||||
|
||||
def _process_event(self, event) -> None:
|
||||
account_id = lib.dc_event_get_account_id(event)
|
||||
evt = lib.dc_event_get_id(event)
|
||||
data1 = lib.dc_event_get_data1_int(event)
|
||||
# the following code relates to the deltachat/_build.py's helper
|
||||
@@ -272,6 +273,7 @@ class EventThread(threading.Thread):
|
||||
data2 = from_optional_dc_charpointer(lib.dc_event_get_data2_str(event))
|
||||
else:
|
||||
data2 = lib.dc_event_get_data2_int(event)
|
||||
assert account_id == self.account.get_id(), f"data2={data2}"
|
||||
|
||||
lib.dc_event_unref(event)
|
||||
ffi_event = FFIEvent(name=evt_name, data1=data1, data2=data2)
|
||||
|
||||
Reference in New Issue
Block a user