aboutsummaryrefslogtreecommitdiff
path: root/include/log.h
diff options
context:
space:
mode:
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