diff options
author | Florian Dold <florian@dold.me> | 2023-10-23 14:52:30 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-10-23 14:52:30 +0200 |
commit | f24451bf9fd2e6893b4897f34bc8a47f3fa20174 (patch) | |
tree | 275e7231b7c1eeb22e379e9f8e07c4536e43fb94 /taler_wallet_core_lib.h | |
parent | b9a0ecb29c6640064367091a2165e4757e9b14ef (diff) | |
download | quickjs-tart-f24451bf9fd2e6893b4897f34bc8a47f3fa20174.tar.gz quickjs-tart-f24451bf9fd2e6893b4897f34bc8a47f3fa20174.tar.bz2 quickjs-tart-f24451bf9fd2e6893b4897f34bc8a47f3fa20174.zip |
prototypes for native logging
Diffstat (limited to 'taler_wallet_core_lib.h')
-rw-r--r-- | taler_wallet_core_lib.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/taler_wallet_core_lib.h b/taler_wallet_core_lib.h index ad7d801..fad3c98 100644 --- 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. |