Syslog Interface
The external syslog interface allows a vendor-specific syslog send function to be used instead of the Linux system syslog daemon. The yp_library user library code can be used to initialize an external syslog send function.
The external syslog send function must follow the C function templates
defined in ncx/log_vendor_extern.h
:
logfn_vendor_init1_t: Phase 1 initialization function
logfn_vendor_send_t: syslog send function
logfn_vendor_cleanup_t: Termination cleanup function
The 'example-system C and H files in the yp-system directory contains example usage of these callback functions.
When the vendor callback is invoked, the vendor code should translate the YumaPro application parameters into an "application" and/or "facility" equivalent appropriate to the vendor logging schema. Likewise, it should translate the YumaPro level parameters into a "message type/level" appropriate to its own requirements.
The following H files need to be included to use the functions in this section:
#include "log.h"
#include "log_vendor.h"
#include "log_vendor_extern.h"
logfn_vendor_send_t
This is the Logging Send function, called by the server when a SYSLOG message needs to be sent.
-
typedef void (*logfn_vendor_send_t)(log_debug_app_t app, log_debug_t level, const char *fstr, va_list args)
Vendor Logging Send Callback.
- Param app:
YumaPro application (such as netconfd-pro or yangcli-pro) This info is already known to syslog via the connect.
- Param level:
YumaPro log message level. This will be translated appropriately into a syslog equivalent
- Param fstr:
start ptr to format string
- Param args:
va_list
The following log send function can be found in example-system.c:
static void
log_vendor_send_fn (log_debug_app_t app,
log_debug_t level,
const char *fstr,
va_list args)
{
(void)app;
(void)level;
(void)fstr;
(void)args;
return;
}