Examples
This section lists different examples for notification.
- The following is an example of I_ERRLOG notification:
struct strioctl ioc; ioc.ic_cmd = I_ERRLOG; ioc.ic_timout = 0; /* default timeout (15 secs.)*/ ioc.ic_len = 0; ioc.ic_dp = NULL; ioctl(log, I_STR, &ioc);
- The following is an example of I_TRCLOG notification:
struct trace_ids tid[2]; tid[0].ti_mid = 2; tid[0].ti_sid = 0; tid[0].ti_level = 1; tid[1].ti_mid = 1002; tid[1].ti_sid = -1; /* any sub-id will be allowed*/ tid[1].ti_level = -1; /* any level will be allowed*/ ioc.ic_cmd = I_TRCLOG; ioc.ic_timeout = 0; ioc.ic_len = 2 * sizeof(struct trace_ids); ioc.ic_dp = (char *)tid; ioctl(log, I_STR, &ioc);
- The following is an example of submitting a log message (no arguments):
struct strbuf ctl, dat; struct log_ctl lc; char *message = "Honey, I'm working late again."; ctl.len = ctl.maxlen = sizeof(lc); ctl.buf = (char *)&lc; dat.len = dat.maxlen = strlen(message); dat.buf = message; lc.level = 0 lc.flags = SL_ERROS; putmsg(log, &ctl, &dat, 0);