chelper: Move logging_callback() to global scope
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
e0db9f3a6e
commit
70a1b752c9
|
@ -218,6 +218,10 @@ FFI_main = None
|
||||||
FFI_lib = None
|
FFI_lib = None
|
||||||
pyhelper_logging_callback = 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
|
# Return the Foreign Function Interface api to the caller
|
||||||
def get_ffi():
|
def get_ffi():
|
||||||
global FFI_main, FFI_lib, pyhelper_logging_callback
|
global FFI_main, FFI_lib, pyhelper_logging_callback
|
||||||
|
@ -238,10 +242,8 @@ def get_ffi():
|
||||||
FFI_main.cdef(d)
|
FFI_main.cdef(d)
|
||||||
FFI_lib = FFI_main.dlopen(destlib)
|
FFI_lib = FFI_main.dlopen(destlib)
|
||||||
# Setup error logging
|
# Setup error logging
|
||||||
def logging_callback(msg):
|
pyhelper_logging_callback = FFI_main.callback("void func(const char *)",
|
||||||
logging.error(FFI_main.string(msg))
|
logging_callback)
|
||||||
pyhelper_logging_callback = FFI_main.callback(
|
|
||||||
"void func(const char *)", logging_callback)
|
|
||||||
FFI_lib.set_python_logging_callback(pyhelper_logging_callback)
|
FFI_lib.set_python_logging_callback(pyhelper_logging_callback)
|
||||||
return FFI_main, FFI_lib
|
return FFI_main, FFI_lib
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue