snprintf(buf, sizeof(buf), "entry %s - %s",
idnode_uuid_as_str(&de->de_id, ubuf),
fmt);
- tvhlogv(file, line, 0, LOG_TRACE, "dvr", buf, &args);
+ tvhlogv(file, line, LOG_TRACE, "dvr", buf, &args);
va_end(args);
}
t2name ? " " : "",
t2name ? gmtime2local(t2, t2buf, sizeof(t2buf)) : "",
fmt);
- tvhlogv(file, line, 0, LOG_TRACE, "dvr", buf, &args);
+ tvhlogv(file, line, LOG_TRACE, "dvr", buf, &args);
va_end(args);
}
}
/* Comet (debug must still be enabled??) */
- if(msg->notify && msg->severity < LOG_TRACE) {
+ if (msg->notify && msg->severity < LOG_TRACE) {
htsmsg_t *m = htsmsg_create_map();
snprintf(buf, sizeof(buf), "%s %s", t, msg->msg);
htsmsg_add_str(m, "notificationClass", "logmessage");
return NULL;
}
-void tvhlogv ( const char *file, int line,
- int notify, int severity,
+void tvhlogv ( const char *file, int line, int severity,
const char *subsys, const char *fmt, va_list *args )
{
- int ok, options;
+ int ok, options, notify;
size_t l;
char buf[1024];
+ notify = (severity & LOG_TVH_NOTIFY) ? 1 : 0;
+ severity &= ~LOG_TVH_NOTIFY;
+
pthread_mutex_lock(&tvhlog_mutex);
/* Check for full */
/*
* Map args
*/
-void _tvhlog ( const char *file, int line,
- int notify, int severity,
+void _tvhlog ( const char *file, int line, int severity,
const char *subsys, const char *fmt, ... )
{
va_list args;
va_start(args, fmt);
- tvhlogv(file, line, notify, severity, subsys, fmt, &args);
+ tvhlogv(file, line, severity, subsys, fmt, &args);
va_end(args);
}
*/
#define HEXDUMP_WIDTH 16
void
-_tvhlog_hexdump(const char *file, int line,
- int notify, int severity,
- const char *subsys,
- const uint8_t *data, ssize_t len )
+_tvhlog_hexdump(const char *file, int line, int severity,
+ const char *subsys, const uint8_t *data, ssize_t len )
{
int i, c;
char str[1024];
c++;
}
str[c] = '\0';
- tvhlogv(file, line, notify, severity, subsys, str, NULL);
+ tvhlogv(file, line, severity, subsys, str, NULL);
len -= HEXDUMP_WIDTH;
data += HEXDUMP_WIDTH;
}
void tvhlog_get_debug ( char *subsys, size_t len );
void tvhlog_set_trace ( const char *subsys );
void tvhlog_get_trace ( char *subsys, size_t len );
-void tvhlogv ( const char *file, int line,
- int notify, int severity,
+void tvhlogv ( const char *file, int line, int severity,
const char *subsys, const char *fmt, va_list *args );
-void _tvhlog ( const char *file, int line,
- int notify, int severity,
+void _tvhlog ( const char *file, int line, int severity,
const char *subsys, const char *fmt, ... )
- __attribute__((format(printf,6,7)));
-void _tvhlog_hexdump ( const char *file, int line,
- int notify, int severity,
- const char *subsys,
- const uint8_t *data, ssize_t len );
+ __attribute__((format(printf,5,6)));
+void _tvhlog_hexdump ( const char *file, int line, int severity,
+ const char *subsys, const uint8_t *data, ssize_t len );
static inline void tvhlog_limit_reset ( tvhlog_limit_t *limit )
{ limit->last = 0; limit->count = 0; }
static inline int tvhlog_limit ( tvhlog_limit_t *limit, uint32_t delay )
#define LOG_TRACE (LOG_DEBUG+1)
#endif
+#define LOG_TVH_NOTIFY 0x40000000
+
/* Macros */
#define tvhlog(severity, subsys, fmt, ...)\
- _tvhlog(__FILE__, __LINE__, 1, severity, subsys, fmt, ##__VA_ARGS__)
+ _tvhlog(__FILE__, __LINE__, severity | LOG_TVH_NOTIFY, subsys, fmt, ##__VA_ARGS__)
#define tvhlog_spawn(severity, subsys, fmt, ...)\
- _tvhlog(__FILE__, __LINE__, 0, severity, subsys, fmt, ##__VA_ARGS__)
+ _tvhlog(__FILE__, __LINE__, severity, subsys, fmt, ##__VA_ARGS__)
#if ENABLE_TRACE
#define tvhtrace_enabled() (LOG_TRACE <= atomic_get(&tvhlog_level))
#define tvhtrace(subsys, fmt, ...) \
do { \
if (tvhtrace_enabled()) \
- _tvhlog(__FILE__, __LINE__, 0, LOG_TRACE, subsys, fmt, ##__VA_ARGS__); \
+ _tvhlog(__FILE__, __LINE__, LOG_TRACE, subsys, fmt, ##__VA_ARGS__); \
} while (0)
#define tvhlog_hexdump(subsys, data, len) \
do { \
if (tvhtrace_enabled()) \
- _tvhlog_hexdump(__FILE__, __LINE__, 0, LOG_TRACE, subsys, (uint8_t*)data, len); \
+ _tvhlog_hexdump(__FILE__, __LINE__, LOG_TRACE, subsys, (uint8_t*)data, len); \
} while (0)
#else
static inline void tvhtrace_no_warnings(const char *fmt, ...) { (void)fmt; }