diff options
-rw-r--r-- | taler_wallet_core_lib.c | 9 | ||||
-rw-r--r-- | taler_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 index d1b2fb8..072b6ac 100644 --- 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 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. |