void ly_vlog(enum LY_ERR code, uint32_t line, ...) { va_list ap; const char *fmt; char line_msg[41]; if (line == UINT_MAX) { return; } ly_errno = LY_EVALID; if (line) { if (ly_log_clb) { sprintf(line_msg, "Parser fails around the line %u.", line); ly_log_clb(LY_LLERR, line_msg); } else { fprintf(stderr, "libyang[%d]: Parser fails around the line %u.\n", LY_LLERR, line); } } if (code == LYE_LINE) { return; } va_start(ap, line); if (code == LYE_SPEC) { fmt = va_arg(ap, char *); log_vprintf(LY_LLERR, fmt, ap); } else {
void dc_log_error(dc_context_t* context, int data1, const char* msg, ...) { va_list va; va_start(va, msg); log_vprintf(context, DC_EVENT_ERROR, data1, msg, va); va_end(va); }
void dc_log_warning(dc_context_t* context, int data1, const char* msg, ...) { va_list va; va_start(va, msg); /* va_start() expects the last non-variable argument as the second parameter */ log_vprintf(context, DC_EVENT_WARNING, data1, msg, va); va_end(va); }
void dc_log_event(dc_context_t* context, int event_code, int data1, const char* msg, ...) { va_list va; va_start(va, msg); /* va_start() expects the last non-variable argument as the second parameter */ log_vprintf(context, event_code, data1, msg, va); va_end(va); }
/** * Write message to system log * * @v fmt Format string * @v ... Arguments */ void log_printf ( const char *fmt, ... ) { va_list args; va_start ( args, fmt ); log_vprintf ( fmt, args ); va_end ( args ); }
void ly_log(LY_LOG_LEVEL level, const char *format, ...) { va_list ap; va_start(ap, format); log_vprintf(level, format, ap); va_end(ap); }
/** Append a message to the currently being written entry. * * Requires that an entry has been started using log_begin() */ int log_printf(const char *fmt, ...) { int ret; va_list args; va_start(args, fmt); ret = log_vprintf(fmt, args); va_end(args); return ret; }
void log_printf(struct log_handle *log, enum LOG_LEVEL lvl, const char *fmt, ...) { va_list args; if ((unsigned)lvl > log->level) { return; } va_start(args, fmt); log_vprintf(log, lvl, fmt, args); va_end(args); }
/** Log a message to the kernel log. * * This atomically appends a log entry. * The resulting message should not contain a trailing newline, as the log * entries are explicitly delimited when stored in the log. */ int log(log_facility_t fac, log_level_t level, const char *fmt, ...) { int ret; va_list args; log_begin(fac, level); va_start(args, fmt); ret = log_vprintf(fmt, args); va_end(args); log_end(); return ret; }
void dc_log_event_seq(dc_context_t* context, int event_code, int* sequence_start, const char* msg, ...) { // logs an event and add a sequence-start-indicator to data1; // once logged, the sequence-start-indicator is set to 0 so that subseqent events are marked as such. // the indicator is useful for the ui eg. to not raise every connection-retry arror to the user. if (context==NULL || sequence_start==NULL || context->magic!=DC_CONTEXT_MAGIC) { return; } va_list va; va_start(va, msg); log_vprintf(context, event_code, *sequence_start, msg, va); *sequence_start = 0; va_end(va); }