Add olm::log_enabled_for
This commit is contained in:
parent
11dbf2aab3
commit
48cb5f925d
2 changed files with 7 additions and 0 deletions
|
@ -27,6 +27,8 @@ const unsigned int LOG_TRACE = 6;
|
||||||
|
|
||||||
void set_log_level(unsigned int log_level);
|
void set_log_level(unsigned int log_level);
|
||||||
|
|
||||||
|
bool log_enabled_for(unsigned int level, const char *category);
|
||||||
|
|
||||||
__attribute__((__format__ (__printf__, 3, 4)))
|
__attribute__((__format__ (__printf__, 3, 4)))
|
||||||
void logf(unsigned int level, const char *category,
|
void logf(unsigned int level, const char *category,
|
||||||
const char *format, ...);
|
const char *format, ...);
|
||||||
|
|
|
@ -26,6 +26,11 @@ void set_log_level(unsigned int level) {
|
||||||
log_level = level;
|
log_level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool log_enabled_for(unsigned int level, const char *category)
|
||||||
|
{
|
||||||
|
return level <= log_level;
|
||||||
|
}
|
||||||
|
|
||||||
void logf(unsigned int level, const char *category,
|
void logf(unsigned int level, const char *category,
|
||||||
const char *format, ...) {
|
const char *format, ...) {
|
||||||
if (level > log_level) {
|
if (level > log_level) {
|
||||||
|
|
Loading…
Reference in a new issue