Changed ca_errmsg callback to a more generic variant
Includes all error, log and debug messages See [Customized NETCONF error message](https://github.com/clicon/clixon/issues/454)
This commit is contained in:
parent
798a9fbfcb
commit
9e54f0602f
83 changed files with 739 additions and 616 deletions
|
|
@ -314,15 +314,27 @@ typedef int (yang_mount_t)(clixon_handle h, cxobj *xt, int *config,
|
|||
*/
|
||||
typedef int (yang_patch_t)(clixon_handle h, yang_stmt *ymod);
|
||||
|
||||
/*! Callback to customize Netconf error message
|
||||
/*! Callback to customize log, error, or debug message
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] xerr Netconf error message on the level: <rpc-error>
|
||||
* @param[out] cberr Translation from netconf err to cbuf.
|
||||
* @retval 0 OK, with cberr set
|
||||
* @retval -1 Error
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] fn Inline function name (when called from clixon_err() macro)
|
||||
* @param[in] line Inline file line number (when called from clixon_err() macro)
|
||||
* @param[in] type Log message type
|
||||
* @param[in,out] category Clixon error category, See enum clixon_err
|
||||
* @param[in,out] suberr Error number, typically errno
|
||||
* @param[in] xerr Netconf error xml tree on the form: <rpc-error>
|
||||
* @param[in] format Format string
|
||||
* @param[in] ap Variable argument list
|
||||
* @param[out] cbmsg Log string as cbuf, if set bypass ordinary logging
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* When cbmsg is set by a plugin, no other plugins are called. category and suberr
|
||||
* can be rewritten by any plugin.
|
||||
*/
|
||||
typedef int (netconf_errmsg_t)(clixon_handle, cxobj *xerr, cbuf *cberr);
|
||||
typedef int (errmsg_t)(clixon_handle h, const char *fn, const int line,
|
||||
enum clixon_log_type type,
|
||||
int *category, int *suberr, cxobj *xerr,
|
||||
const char *format, va_list ap, cbuf **cbmsg);
|
||||
|
||||
/*! Callback for printing version output and exit
|
||||
*
|
||||
|
|
@ -366,7 +378,7 @@ struct clixon_plugin_api{
|
|||
plgextension_t *ca_extension; /* Yang extension/unknown handler */
|
||||
yang_mount_t *ca_yang_mount; /* RFC 8528 schema mount */
|
||||
yang_patch_t *ca_yang_patch; /* Patch yang after parse */
|
||||
netconf_errmsg_t *ca_errmsg; /* Customize error message callback */
|
||||
errmsg_t *ca_errmsg; /* Customize log/error/debug callback */
|
||||
plgversion_t *ca_version; /* Output a customized version message */
|
||||
union {
|
||||
struct { /* cli-specific */
|
||||
|
|
@ -497,8 +509,16 @@ int clixon_plugin_yang_mount_all(clixon_handle h, cxobj *xt, int *config, valida
|
|||
int clixon_plugin_yang_patch_one(clixon_plugin_t *cp, clixon_handle h, yang_stmt *ymod);
|
||||
int clixon_plugin_yang_patch_all(clixon_handle h, yang_stmt *ymod);
|
||||
|
||||
int clixon_plugin_netconf_errmsg_one(clixon_plugin_t *cp, clixon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
int clixon_plugin_netconf_errmsg_all(clixon_handle h, cxobj *xerr, cbuf *cberr);
|
||||
int clixon_plugin_errmsg_one(clixon_plugin_t *cp, clixon_handle h,
|
||||
const char *fn, const int line,
|
||||
enum clixon_log_type type,
|
||||
int *category, int *suberr, cxobj *xerr,
|
||||
const char *format, va_list ap, cbuf **cbmsg);
|
||||
int clixon_plugin_errmsg_all(clixon_handle h,
|
||||
const char *fn, const int line,
|
||||
enum clixon_log_type type,
|
||||
int *category, int *suberr, cxobj *xerr,
|
||||
const char *format, va_list ap, cbuf **cbmsg);
|
||||
|
||||
int clixon_plugin_version_one(clixon_plugin_t *cp, clixon_handle h, FILE *f);
|
||||
int clixon_plugin_version_all(clixon_handle h, FILE *f);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue