aboutsummaryrefslogtreecommitdiff
path: root/src/nissy.h
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 /src/nissy.h
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 'src/nissy.h')
-rw-r--r--src/nissy.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nissy.h b/src/nissy.h
index 816e03a..b13f417 100644
--- a/src/nissy.h
+++ b/src/nissy.h
@@ -421,7 +421,11 @@ Set a global logger function used by this library. Setting the logger to NULL
421disables logging. 421disables logging.
422 422
423Parameters: 423Parameters:
424 write - A callback writer with the same signature as printf(3). 424 logger_function - A pointer to a function that takes two parameters:
425 * A C string, the string to be printed.
426 * Any other data via a void pointer.
427 user_data - Any data that will be provided by the logger when
428 calling logger_function.
425 429
426Return values: 430Return values:
427 NISSY_OK - Logger set succesfully. No warning or error is going to be given 431 NISSY_OK - Logger set succesfully. No warning or error is going to be given
@@ -429,5 +433,6 @@ Return values:
429*/ 433*/
430long long 434long long
431nissy_setlogger( 435nissy_setlogger(
432 void (*logger_function)(const char *) 436 void (*logger_function)(const char *, void *),
437 void *user_data
433); 438);

Generated with cgit - Back to sebastiano.tronto.net