libchewing
libchewing copied to clipboard
Support logger without variable argument list
libchewing only accepts logger callback with variable argument list so far. However, it seems difficult to implement such callback using other language (eg. Python). This prevents direct access of log messages. Here, the PR implements a new built-in logger and a new API to remove the restriction.
- It is cleaner to use vasprintf. However, vasprintf is not in C standard, and additional implementation will be needed to pass MSVC compilation.
Coverage decreased (-0.4%) to 90.212% when pulling 447b5fc70d37f0a902678c8f5c80b4ce24b0c151 on school510587:no_var_arg_list_logger into e469f5b9f387004ebfd72394ed15cc93e877fdf3 on chewing:master.
Hi @jserv, I just follow the style of naming of chewing_new2. Actually I don't know how to select a meaningful name for chewing_set_logger2, because it may be too long. Do you think a name like chewing_set_logger_without_varglist is proper?
Cc. @czchen
The functionality of chewing_new2
is to provide another way to initialize Chewing engine. However, the function proposed by @school510587 is a different story, IMHO. I would suggest explicit naming.
Coverage decreased (-0.4%) to 90.647% when pulling 016873b6d197d3bdf76dffb663fe947a013172e0 on school510587:no_var_arg_list_logger into 2ebcf130c888e8dd1af13c15c5e3ec87e27aee85 on chewing:master.
How about using Swig to resolve the convention? Reference: http://www.swig.org/Doc1.3/Varargs.html
Can you rebase for reviewing?