void
nssLog(nssLogPriority prio,
+ const char *filename,
const char *func,
int linenr,
const char *fmt, ...)
if (!getenv(NSS_LOG_ENV_VAR))
return;
- fprintf(stderr, "%s %s:%d : ", nssLogPriorityToString(prio), func, linenr);
+ if ((filename = strrchr(filename, '/')))
+ filename++;
+
+ fprintf(stderr, "%s %s:%s():%d : ",
+ nssLogPriorityToString(prio), NULLSTR(filename), func, linenr);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
} nssLogPriority;
#define DEBUG(...) \
- nssLog(NSS_DEBUG, __FUNCTION__, __LINE__, __VA_ARGS__)
+ nssLog(NSS_DEBUG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
#define ERROR(...) \
- nssLog(NSS_ERROR, __FUNCTION__, __LINE__, __VA_ARGS__)
+ nssLog(NSS_ERROR, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
#define NSS_LOG_ENV_VAR "LIBVIRT_NSS_DEBUG"
void
nssLog(nssLogPriority prio,
+ const char *filename,
const char *func,
int linenr,
- const char *fmt, ...) __attribute__ ((format(printf, 4, 5)));
+ const char *fmt, ...) __attribute__ ((format(printf, 5, 6)));