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 /shell/shell.c | |
| 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-- | shell/shell.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shell/shell.c b/shell/shell.c index 6b349e5..1ef1a39 100644 --- a/shell/shell.c +++ b/shell/shell.c | |||
| @@ -780,7 +780,7 @@ set_threads(int argc, char **argv, args_t *args) | |||
| 780 | } | 780 | } |
| 781 | 781 | ||
| 782 | void | 782 | void |
| 783 | log_stderr(const char *str) | 783 | log_stderr(const char *str, void *unused) |
| 784 | { | 784 | { |
| 785 | fprintf(stderr, "%s", str); | 785 | fprintf(stderr, "%s", str); |
| 786 | } | 786 | } |
| @@ -792,7 +792,7 @@ main(int argc, char **argv) | |||
| 792 | args_t args; | 792 | args_t args; |
| 793 | 793 | ||
| 794 | srand(time(NULL)); | 794 | srand(time(NULL)); |
| 795 | nissy_setlogger(log_stderr); | 795 | nissy_setlogger(log_stderr, NULL); |
| 796 | 796 | ||
| 797 | parse_error = parse_args(argc-1, argv+1, &args); | 797 | parse_error = parse_args(argc-1, argv+1, &args); |
| 798 | if (parse_error) | 798 | if (parse_error) |
