summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorSimon Rettberg2017-11-07 16:19:40 +0100
committerSimon Rettberg2017-11-07 16:19:40 +0100
commit7185af659a7b68477400d3544e481353c11f5b82 (patch)
treeb5ae54c62cb949ed53e63687894ad90ee66a6787 /src/shared
parent[FUSE] Reset salen before getpeername() call (diff)
downloaddnbd3-7185af659a7b68477400d3544e481353c11f5b82.tar.gz
dnbd3-7185af659a7b68477400d3544e481353c11f5b82.tar.xz
dnbd3-7185af659a7b68477400d3544e481353c11f5b82.zip
[SHARED] Add log_hasMask() to check if a certain loglevel is set
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/log.c5
-rw-r--r--src/shared/log.h6
2 files changed, 11 insertions, 0 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 62b104e..701bc89 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -41,6 +41,11 @@ static int logFd = -1;
static int writeLevel(char *buffer, logmask_t level);
+bool log_hasMask(const logmask_t mask)
+{
+ return ( ( maskFile | maskCon ) & mask ) == mask;
+}
+
void log_setFileMask(logmask_t mask)
{
maskFile = mask;
diff --git a/src/shared/log.h b/src/shared/log.h
index 74b3511..ac5bb92 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -31,6 +31,12 @@ typedef unsigned int logmask_t;
#define LOG_DEBUG1 ((logmask_t)16) // Debug information, use this for non-spammy stuff
#define LOG_DEBUG2 ((logmask_t)32) // Use this for debug messages that will show up a lot
+
+/**
+ * Check if cansoleMask | fileMask has all of mask set.
+ */
+bool log_hasMask(const logmask_t mask);
+
void log_setFileMask(logmask_t mask);
void log_setConsoleMask(logmask_t mask);