aboutsummaryrefslogtreecommitdiff
path: root/cpp/nissy.cpp
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-04-15 15:51:40 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-04-15 15:51:40 +0200
commitb25a939e2d8b045c083caf3264c4e5aac1cf88fb (patch)
tree37b862c82389ceddcf4624b5e26536390d6b8265 /cpp/nissy.cpp
parentb02c083a3545b6e6b36ab62680128edec619a804 (diff)
downloadnissy-core-b25a939e2d8b045c083caf3264c4e5aac1cf88fb.tar.gz
nissy-core-b25a939e2d8b045c083caf3264c4e5aac1cf88fb.zip
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.
Diffstat (limited to 'cpp/nissy.cpp')
-rw-r--r--cpp/nissy.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/cpp/nissy.cpp b/cpp/nissy.cpp
index 2a52ab1..944944b 100644
--- a/cpp/nissy.cpp
+++ b/cpp/nissy.cpp
@@ -24,7 +24,7 @@ extern "C" {
24 unsigned, unsigned, int, int, unsigned long long, const char *, 24 unsigned, unsigned, int, int, unsigned long long, const char *,
25 unsigned, char *, long long *); 25 unsigned, char *, long long *);
26 long long nissy_countmoves(const char *); 26 long long nissy_countmoves(const char *);
27 long long nissy_setlogger(void (*)(const char *)); 27 long long nissy_setlogger(void (*)(const char *, void *), void *);
28} 28}
29 29
30namespace nissy { 30namespace nissy {
@@ -227,5 +227,8 @@ namespace nissy {
227 return error{err}; 227 return error{err};
228 } 228 }
229 229
230 void set_logger(void (*log)(const char *)) { nissy_setlogger(log); } 230 void set_logger(void (*log)(const char *, void *), void *data)
231 {
232 nissy_setlogger(log, data);
233 }
231} 234}

Generated with cgit - Back to sebastiano.tronto.net