mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
python: Allow to configure debug logging via account
This commit is contained in:
committed by
holger krekel
parent
20b82b3638
commit
03661e2a71
@@ -22,7 +22,7 @@ class Account(object):
|
|||||||
by the underlying deltachat c-library. All public Account methods are
|
by the underlying deltachat c-library. All public Account methods are
|
||||||
meant to be memory-safe and return memory-safe objects.
|
meant to be memory-safe and return memory-safe objects.
|
||||||
"""
|
"""
|
||||||
def __init__(self, db_path, logid=None, eventlogging=True):
|
def __init__(self, db_path, logid=None, eventlogging=True, debug=True):
|
||||||
""" initialize account object.
|
""" initialize account object.
|
||||||
|
|
||||||
:param db_path: a path to the account database. The database
|
:param db_path: a path to the account database. The database
|
||||||
@@ -30,13 +30,14 @@ class Account(object):
|
|||||||
:param logid: an optional logging prefix that should be used with
|
:param logid: an optional logging prefix that should be used with
|
||||||
the default internal logging.
|
the default internal logging.
|
||||||
:param eventlogging: if False no eventlogging and no context callback will be configured
|
:param eventlogging: if False no eventlogging and no context callback will be configured
|
||||||
|
:param debug: turn on debug logging for events.
|
||||||
"""
|
"""
|
||||||
self._dc_context = ffi.gc(
|
self._dc_context = ffi.gc(
|
||||||
lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL),
|
lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL),
|
||||||
_destroy_dc_context,
|
_destroy_dc_context,
|
||||||
)
|
)
|
||||||
if eventlogging:
|
if eventlogging:
|
||||||
self._evlogger = EventLogger(self._dc_context, logid)
|
self._evlogger = EventLogger(self._dc_context, logid, debug)
|
||||||
deltachat.set_context_callback(self._dc_context, self._process_event)
|
deltachat.set_context_callback(self._dc_context, self._process_event)
|
||||||
self._threads = IOThreads(self._dc_context, self._evlogger._log_event)
|
self._threads = IOThreads(self._dc_context, self._evlogger._log_event)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user