Update C/C++ demos to support new Logger API
[ldk-c-bindings] / lightning-c-bindings / demo.c
index e8a0997363b9291cfce627339c6dba1116950b5a..dfa0e2fadbd835619f38c2dc8e98b4a852d71eec 100644 (file)
@@ -4,8 +4,12 @@
 #include <stdio.h>
 #include <string.h>
 
-void print_log(const void *this_arg, const char *record) {
-       printf("%s", record);
+void print_log(const void *this_arg, const LDKRecord *record) {
+       LDKStr mod = Record_get_module_path(record);
+       LDKStr str = Record_get_args(record);
+       printf("%.*s:%d - %.*s\n", (int)mod.len, mod.chars, Record_get_line(record), (int)str.len, str.chars);
+       Str_free(str);
+       Str_free(mod);
 }
 
 uint32_t get_fee(const void *this_arg, LDKConfirmationTarget target) {