summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Logger.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Common/Logger.h b/src/Common/Logger.h
index 4b25dd0..593fd7a 100644
--- a/src/Common/Logger.h
+++ b/src/Common/Logger.h
@@ -24,7 +24,7 @@
#include <cstdarg>
#include <list>
#include <string>
-#include <stdint.h>
+#include <bitset>
namespace Mad {
namespace Common {
@@ -36,18 +36,18 @@ class Logger {
};
enum MessageCategory {
- SYSTEM = 0x0001, NETWORK = 0x0002, DAEMON = 0x0004, USER = 0x0008, DISK = 0x0010, PROGRAM = 0x0020, GENERAL = 0x0040
+ SYSTEM, NETWORK, DAEMON, USER, DISK, PROGRAM, GENERAL
};
private:
static std::list<Logger*> loggers;
- uint16_t categories;
+ std::bitset<16> categories;
MessageLevel level;
static void logfv(MessageCategory category, MessageLevel level, const char *format, va_list ap);
protected:
- Logger() : categories(0xFFFF), level(DEFAULT) {}
+ Logger() : level(DEFAULT) {setAllCategories();}
virtual void logMessage(MessageCategory category, MessageLevel level, const std::string &message) = 0;
public:
@@ -78,23 +78,23 @@ class Logger {
}
void setCategory(MessageCategory newCategory) {
- categories |= newCategory;
+ categories.set(newCategory);
}
void unsetCategory(MessageCategory oldCategory) {
- categories &= ~oldCategory;
+ categories.reset(oldCategory);
}
void setAllCategories() {
- categories = 0xFFFF;
+ categories.set();
}
void unsetAllCategories() {
- categories = 0;
+ categories.reset();
}
bool isCategorySet(MessageCategory category) {
- return ((categories & category) != 0);
+ return categories.test(category);
}
MessageLevel getLevel() const {