diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-03-01 13:30:02 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-03-01 13:30:02 -0500 |
commit | 70a1b752c9930beb5bdc7f7c07f8cc9b94333c56 (patch) | |
tree | d823a205cabd0d80325d84a9e2f8b769f107c2d8 /klippy/chelper | |
parent | e0db9f3a6ec5caf619cba2e693be1b155df052f4 (diff) | |
download | kutter-70a1b752c9930beb5bdc7f7c07f8cc9b94333c56.tar.gz kutter-70a1b752c9930beb5bdc7f7c07f8cc9b94333c56.tar.xz kutter-70a1b752c9930beb5bdc7f7c07f8cc9b94333c56.zip |
chelper: Move logging_callback() to global scope
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper')
-rw-r--r-- | klippy/chelper/__init__.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/klippy/chelper/__init__.py b/klippy/chelper/__init__.py index 851fda70..76d5c4b4 100644 --- a/klippy/chelper/__init__.py +++ b/klippy/chelper/__init__.py @@ -218,6 +218,10 @@ FFI_main = None FFI_lib = None pyhelper_logging_callback = None +# Hepler invoked from C errorf() code to log errors +def logging_callback(msg): + logging.error(FFI_main.string(msg)) + # Return the Foreign Function Interface api to the caller def get_ffi(): global FFI_main, FFI_lib, pyhelper_logging_callback @@ -238,10 +242,8 @@ def get_ffi(): FFI_main.cdef(d) FFI_lib = FFI_main.dlopen(destlib) # Setup error logging - def logging_callback(msg): - logging.error(FFI_main.string(msg)) - pyhelper_logging_callback = FFI_main.callback( - "void func(const char *)", logging_callback) + pyhelper_logging_callback = FFI_main.callback("void func(const char *)", + logging_callback) FFI_lib.set_python_logging_callback(pyhelper_logging_callback) return FFI_main, FFI_lib |