Debugging of libmisdn shows file and line now

This commit is contained in:
Andreas Eversberg 2023-01-23 19:17:24 +01:00
parent 8c10ee4a26
commit de611e513d
2 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,7 @@
#include <stdarg.h>
#include "printk.h"
void printk(const char *fmt, ...)
void _printk(const char *file, const char *function, int line, const char *fmt, ...)
{
char buffer[4096], *b = buffer;
int s = sizeof(buffer) - 1;
@ -22,6 +22,6 @@ void printk(const char *fmt, ...)
vsnprintf(b, s, fmt, args);
va_end(args);
PDEBUG(DMISDN, level, "%s", b);
_printdebug(file, function, line, DMISDN, level, NULL, "%s", b);
}

View File

@ -11,6 +11,7 @@
#define KERN_WARNING "2"
#define KERN_ERR "3"
void printk(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
#define printk(fmt, arg...) _printk(__FILE__, __FUNCTION__, __LINE__, fmt, ## arg)
void _printk(const char *file, const char *function, int line, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5)));
#endif