diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-15 15:51:40 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-15 15:51:40 +0200 |
| commit | b25a939e2d8b045c083caf3264c4e5aac1cf88fb (patch) | |
| tree | 37b862c82389ceddcf4624b5e26536390d6b8265 /cpp/nissy.cpp | |
| parent | b02c083a3545b6e6b36ab62680128edec619a804 (diff) | |
| download | nissy-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 '')
| -rw-r--r-- | cpp/nissy.cpp | 7 |
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 | ||
| 30 | namespace nissy { | 30 | namespace 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 | } |
