diff options
| author | Cy Schubert <cy@FreeBSD.org> | 2020-12-08 21:23:03 +0000 |
|---|---|---|
| committer | Cy Schubert <cy@FreeBSD.org> | 2020-12-08 21:23:03 +0000 |
| commit | c1dbcbf2d10cd99864ab0eb44358d9875ba0c0a5 (patch) | |
| tree | 8cbca8d9dc814933d2bc59b6623b792b549aac6b /pythonmod/interface.i | |
| parent | 4cb89f2eee3bb358f0491932ab0498b5319f4229 (diff) | |
Notes
Diffstat (limited to 'pythonmod/interface.i')
| -rw-r--r-- | pythonmod/interface.i | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pythonmod/interface.i b/pythonmod/interface.i index 71f2bf774d0f..cbee4f714764 100644 --- a/pythonmod/interface.i +++ b/pythonmod/interface.i @@ -1413,6 +1413,19 @@ struct delegpt* find_delegation(struct module_qstate* qstate, char *nm, size_t n /****************************** * Various debugging functions * ******************************/ + +/* rename the variadic functions because python does the formatting already*/ +%rename (unbound_log_info) log_info; +%rename (unbound_log_err) log_err; +%rename (unbound_log_warn) log_warn; +%rename (unbound_verbose) verbose; +/* provide functions that take one string as argument, so python can cook +the string */ +%rename (log_info) pymod_log_info; +%rename (log_warn) pymod_log_warn; +%rename (log_err) pymod_log_err; +%rename (verbose) pymod_verbose; + void verbose(enum verbosity_value level, const char* format, ...); void log_info(const char* format, ...); void log_err(const char* format, ...); @@ -1422,6 +1435,19 @@ void log_dns_msg(const char* str, struct query_info* qinfo, struct reply_info* r void log_query_info(enum verbosity_value v, const char* str, struct query_info* qinf); void regional_log_stats(struct regional *r); +/* the one argument string log functions */ +void pymod_log_info(const char* str); +void pymod_log_err(const char* str); +void pymod_log_warn(const char* str); +void pymod_verbose(enum verbosity_value level, const char* str); +%{ +void pymod_log_info(const char* str) { log_info("%s", str); } +void pymod_log_err(const char* str) { log_err("%s", str); } +void pymod_log_warn(const char* str) { log_warn("%s", str); } +void pymod_verbose(enum verbosity_value level, const char* str) { + verbose(level, "%s", str); } +%} + /*************************************************************************** * Free allocated memory from marked sources returning corresponding types * ***************************************************************************/ |
