quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit f24451bf9fd2e6893b4897f34bc8a47f3fa20174
parent b9a0ecb29c6640064367091a2165e4757e9b14ef
Author: Florian Dold <florian@dold.me>
Date:   Mon, 23 Oct 2023 14:52:30 +0200

prototypes for native logging

Diffstat:
Mtaler_wallet_core_lib.c | 9+++++++++
Mtaler_wallet_core_lib.h | 32++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/taler_wallet_core_lib.c b/taler_wallet_core_lib.c @@ -92,6 +92,15 @@ TALER_WALLET_set_message_handler(struct TALER_WALLET_Instance *twi, } +void +TALER_WALLET_set_log_handler(struct TALER_WALLET_Instance *twi, + TALER_WALLET_LogHandlerFn *handler_f, + void *handler_cls) +{ + // FIXME: Implement! +} + + int TALER_WALLET_send_request (struct TALER_WALLET_Instance *twi, const char *msg) diff --git a/taler_wallet_core_lib.h b/taler_wallet_core_lib.h @@ -38,6 +38,13 @@ struct TALER_WALLET_Instance; */ typedef void (*TALER_WALLET_MessageHandlerFn)(void *handler_p, const char *message); +enum TALER_WALLET_LogLevel { + TALER_WALLET_LOG_TRACE = 1, + TALER_WALLET_LOG_INFO = 2, + TALER_WALLET_LOG_WARN = 3, + TALER_WALLET_LOG_ERROR = 4 +}; + /** * Create a new wallet-core instance.. */ @@ -55,6 +62,31 @@ TALER_WALLET_set_message_handler(struct TALER_WALLET_Instance *twi, TALER_WALLET_MessageHandlerFn handler_f, void *handler_p); +/** + * Handler for log message from wallet-core. + * + * @param log_p opaque closure for the log handler + * @param level log level of the log message + * @param tag log tag (usually the file from which the message gets logged) + * @param msg the log message + */ +typedef void (*TALER_WALLET_LogHandlerFn)(void *log_p, + enum TALER_WALLET_LogLevel level, + const char *tag, + const char *msg); + + +/** + * Set a handler for log messages from wallet-core. + * Must be called before the wallet runs. + * + * Caution: The log message handler will be called from a different thread. + */ +void +TALER_WALLET_set_log_handler(struct TALER_WALLET_Instance *twi, + TALER_WALLET_LogHandlerFn *handler_f, + void *handler_p); + /** * Set/override the JS file with the wallet-core implementation.