aboutsummaryrefslogtreecommitdiff
path: root/include/log.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 17:18:59 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 17:18:59 +0100
commit22d05ce647281056d71fbd3c31df3bcd6396188d (patch)
tree90208930f54c47987bfd5ffcf0a0acaaad2510da /include/log.h
parented5044da43172d86a1aa475473561a4818b7c69c (diff)
parentac6b9c18ef55f4cd36e85069cf0cf82c14e04404 (diff)
downloadlibnitrokey-22d05ce647281056d71fbd3c31df3bcd6396188d.tar.gz
libnitrokey-22d05ce647281056d71fbd3c31df3bcd6396188d.tar.bz2
Merge branch 'libnitrokey_3'
Diffstat (limited to 'include/log.h')
-rw-r--r--include/log.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/log.h b/include/log.h
index 8eda4fb..7c25918 100644
--- a/include/log.h
+++ b/include/log.h
@@ -6,6 +6,12 @@
namespace nitrokey {
namespace log {
+//for MSVC
+#ifdef ERROR
+#undef ERROR
+#endif
+
+
enum class Loglevel : int { DEBUG_L2, DEBUG, INFO, WARNING, ERROR };
class LogHandler {
@@ -28,7 +34,7 @@ class Log {
Log() : mp_loghandler(&stdlog_handler), m_loglevel(Loglevel::WARNING) {}
static Log &instance() {
- if (mp_instance == NULL) mp_instance = new Log;
+ if (mp_instance == nullptr) mp_instance = new Log;
return *mp_instance;
}
@@ -47,4 +53,11 @@ class Log {
}
}
+
+#ifdef NO_LOG
+#define LOG(string, level) while(false){}
+#else
+#define LOG(string, level) nitrokey::log::Log::instance()((string), (level))
+#endif
+
#endif