Exemple #1
0
void vapplog(int prio, const char *fmt, va_list ap)
{
	if (!opt_debug && prio == LOG_DEBUG)
		return;
	if (use_syslog || opt_log_output || prio <= LOG_NOTICE)
		log_generic(prio, fmt, ap);
}
Exemple #2
0
void log_err(const char *format, ...)
{
    va_list args;
    va_start(args, format);
    log_generic(MESSAGE_TYPE_ERROR, format, args);
    va_end(args);
}
Exemple #3
0
void log_fatal(const char *format, ...)
{
    va_list args;
    va_start(args, format);
    log_generic(MESSAGE_TYPE_FATAL, format, args);
    va_end(args);
}
Exemple #4
0
void log_info(const char *format, ...)
{
    va_list args;
    va_start(args, format);
    log_generic(MESSAGE_TYPE_INFO, format, args);
    va_end(args);
}
Exemple #5
0
void log_fatal(const char *file, int line, const char *func, bool show_perror, void *ctx, const char *fmt, ...)
{
	char buf[2048], ebuf[256];
	const char *estr = NULL;
	int old_errno = 0;
	va_list ap;

	if (show_perror) {
		old_errno = errno;
		estr = strerror_r(errno, ebuf, sizeof(ebuf));
	}

	va_start(ap, fmt);
	vsnprintf(buf, sizeof(buf), fmt, ap);
	va_end(ap);

	if (show_perror) {
		log_generic(LG_FATAL, ctx, "@%s:%d in function %s(): %s: %s [%d]",
			     file, line, func, buf, estr, old_errno);
	} else {
		log_generic(LG_FATAL, ctx, "@%s:%d in function %s(): %s",
			     file, line, func, buf);
	}
}