#ifndef __LOG_H__
#define __LOG_H__

#include <stdint.h>
#include "version.h"
#include "teePlatformConfig.h"

int32_t log_print(const char* tag, const char* file, uint32_t line,
               const char* fmt, ...);

#define PRINT_MESSAGE(TAG, FMT, ...) \
    log_print(TAG, __FILE__, __LINE__, FMT, ##__VA_ARGS__)

#define LOGI(fmt, ...) PRINT_MESSAGE("[I]"TRUSTLET_TAG, fmt, ##__VA_ARGS__)
#define LOGE(fmt, ...) PRINT_MESSAGE("[E]"TRUSTLET_TAG, fmt, ##__VA_ARGS__)
#if (defined DEBUG)
#define LOGD(fmt, ...) PRINT_MESSAGE("[D]"TRUSTLET_TAG, fmt, ##__VA_ARGS__)
#else
//#define LOGD(fmt, ...) PRINT_MESSAGE("[D]"TRUSTLET_TAG, fmt, ##__VA_ARGS__)
#define LOGD(fmt, ...)
#endif  // End of DEBUG

#define VERSIONIZE(name) \
LOGI("===============================");\
LOGI(" %s trustlet v%s", name, VERSION);\
LOGI("===============================");
#endif  // End of __LOG_H__
