Make ulog able to also log via udebug.
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
static int _ulog_threshold = LOG_DEBUG;
static int _ulog_initialized = 0;
static const char *_ulog_ident = NULL;
static int _ulog_threshold = LOG_DEBUG;
static int _ulog_initialized = 0;
static const char *_ulog_ident = NULL;
+static struct udebug_buf *udb = NULL;
static const char *ulog_default_ident(void)
{
static const char *ulog_default_ident(void)
{
vsyslog(priority, fmt, ap);
}
vsyslog(priority, fmt, ap);
}
+void ulog_udebug(struct udebug_buf *_udb)
+{
+ udb = _udb;
+}
+
void ulog_open(int channels, int facility, const char *ident)
{
ulog_close();
void ulog_open(int channels, int facility, const char *ident)
{
ulog_close();
+ if (udb) {
+ va_start(ap, fmt);
+ udebug_entry_init(udb);
+ udebug_entry_vprintf(udb, fmt, ap);
+ udebug_entry_add(udb);
+ va_end(ap);
+ }
+
if (priority > _ulog_threshold)
return;
if (priority > _ulog_threshold)
return;
enum {
ULOG_KMSG = (1 << 0),
ULOG_SYSLOG = (1 << 1),
enum {
ULOG_KMSG = (1 << 0),
ULOG_SYSLOG = (1 << 1),
};
void ulog_open(int channels, int facility, const char *ident);
};
void ulog_open(int channels, int facility, const char *ident);
+void ulog_udebug(struct udebug_buf *udb);
void ulog_close(void);
void ulog_threshold(int threshold);
void ulog_close(void);
void ulog_threshold(int threshold);