From f8217d240d598f39f70047f7a623dd46312542c6 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 4 Dec 2021 16:01:12 -0800 Subject: Initial commit. --- log/include/log/log.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 log/include/log/log.h (limited to 'log/include') diff --git a/log/include/log/log.h b/log/include/log/log.h new file mode 100644 index 0000000..41a83cc --- /dev/null +++ b/log/include/log/log.h @@ -0,0 +1,19 @@ +#pragma once + +// Current implementation assumes a posix environment. + +#include + +typedef enum { LogDebug, LogInfo, LogWarning, LogError } LogLevel; + +#define LOG(tag, ...) \ + { \ + printf("[%s] %s:%d: ", #tag, __FILE__, __LINE__); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + } + +#define LOGD(...) LOG(DEBUG, __VA_ARGS__) +#define LOGI(...) LOG(INFO, __VA_ARGS__) +#define LOGW(...) LOG(WARN, __VA_ARGS__) +#define LOGE(...) LOG(ERROR, __VA_ARGS__) -- cgit v1.2.3