Commit 784c57e1 authored by Simon Morlat's avatar Simon Morlat

add ortp_set_log_level()

parent 0c8d9dda
......@@ -39,11 +39,11 @@ extern "C"
typedef enum {
ORTP_DEBUG=1,
ORTP_MESSAGE=1<<1,
ORTP_WARNING=1<<2,
ORTP_ERROR=1<<3,
ORTP_FATAL=1<<4,
ORTP_TRACE=1<<5,
ORTP_TRACE=1<<1,
ORTP_MESSAGE=1<<2,
ORTP_WARNING=1<<3,
ORTP_ERROR=1<<4,
ORTP_FATAL=1<<5,
ORTP_LOGLEV_END=1<<6
} OrtpLogLevel;
......@@ -66,6 +66,11 @@ ORTP_PUBLIC void ortp_logv(const char *domain, OrtpLogLevel level, const char *f
*/
ORTP_PUBLIC void ortp_logv_flush(void);
/**
* Activate all log level greater or equal than specified level argument.
**/
ORTP_PUBLIC void ortp_set_log_level(const char *domain, OrtpLogLevel level);
ORTP_PUBLIC void ortp_set_log_level_mask(const char *domain, int levelmask);
ORTP_PUBLIC unsigned int ortp_get_log_level_mask(const char *domain);
......
......@@ -121,6 +121,27 @@ void ortp_set_log_level_mask(const char *domain, int levelmask){
else get_log_domain_rw(domain)->logmask = levelmask;
}
void ortp_set_log_level(const char *domain, OrtpLogLevel level){
int levelmask = ORTP_FATAL;
if (level<=ORTP_ERROR){
levelmask |= ORTP_ERROR;
}
if (level<=ORTP_WARNING){
levelmask |= ORTP_WARNING;
}
if (level<=ORTP_MESSAGE){
levelmask |= ORTP_MESSAGE;
}
if (level<=ORTP_TRACE){
levelmask |= ORTP_TRACE;
}
if (level<=ORTP_DEBUG){
levelmask |= ORTP_DEBUG;
}
ortp_set_log_level_mask(domain, levelmask);
}
unsigned int ortp_get_log_level_mask(const char *domain) {
OrtpLogDomain *ld;
if (domain == NULL || (ld = get_log_domain(domain)) == NULL) return __ortp_logger.log_mask;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment