libchewing icon indicating copy to clipboard operation
libchewing copied to clipboard

Support logger without variable argument list

Open school510587 opened this issue 7 years ago • 6 comments

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.

school510587 avatar Jul 22 '17 21:07 school510587

Coverage Status

Coverage decreased (-0.4%) to 90.212% when pulling 447b5fc70d37f0a902678c8f5c80b4ce24b0c151 on school510587:no_var_arg_list_logger into e469f5b9f387004ebfd72394ed15cc93e877fdf3 on chewing:master.

coveralls avatar Jul 22 '17 21:07 coveralls

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?

school510587 avatar Aug 09 '17 13:08 school510587

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.

jserv avatar Aug 10 '17 23:08 jserv

Coverage Status

Coverage decreased (-0.4%) to 90.647% when pulling 016873b6d197d3bdf76dffb663fe947a013172e0 on school510587:no_var_arg_list_logger into 2ebcf130c888e8dd1af13c15c5e3ec87e27aee85 on chewing:master.

coveralls avatar Aug 11 '17 07:08 coveralls

How about using Swig to resolve the convention? Reference: http://www.swig.org/Doc1.3/Varargs.html

jserv avatar Aug 11 '17 07:08 jserv

Can you rebase for reviewing?

jserv avatar Jul 20 '19 01:07 jserv