From b25a939e2d8b045c083caf3264c4e5aac1cf88fb Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 15 Apr 2025 15:51:40 +0200 Subject: Better logging function Now it is possible to provide some data together with the logging function. This is useful for example in C++, where I can now provide an arbitrary callable object as data, and a simple wrapper function that call the callable object as logging function. --- python/nissy_module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/nissy_module.c b/python/nissy_module.c index da0b1c5..e92cfd9 100644 --- a/python/nissy_module.c +++ b/python/nissy_module.c @@ -421,7 +421,7 @@ static struct PyModuleDef nissy_python_module = { }; static void -log_stdout(const char *str) +log_stdout(const char *str, void *unused) { fprintf(stderr, "%s", str); } @@ -429,7 +429,7 @@ log_stdout(const char *str) PyMODINIT_FUNC PyInit_nissy_python_module(void) { PyObject *module; - nissy_setlogger(log_stdout); + nissy_setlogger(log_stdout, NULL); module = PyModule_Create(&nissy_python_module); PyModule_AddStringConstant(module, "solved_cube", NISSY_SOLVED_CUBE); -- cgit v1.3