Safeheron-SGX-Native-Development-Framework v1.2.0
Loading...
Searching...
No Matches
ssgx_log_t.h
Go to the documentation of this file.
1#ifndef SAFEHERON_SGX_LOG_T_H
2#define SAFEHERON_SGX_LOG_T_H
3
4#ifdef SAFEHERON_SGX_LOG_U_H
5#error "SAFEHERON_SGX_LOG_U_H is already defined. Compilation stopped."
6#endif
7
8#include <cstdio>
9#include <cstring>
10#include <string>
11
12#include "ssgx_log_t_logger.h"
13
14// Internal macro
15#define __SSGX__FILENAME__ (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : __FILE__)
16
17#undef SSGX_LOG
18#undef SSGX_LOG_IF
19// @exception RuntimeError Throw exception if logger has not been initialized.
20#define SSGX_LOG(LEVEL) \
21 ssgx::log_t::internal::LogFinisher() = \
22 ssgx::log_t::internal::LogMessage(ssgx::log_t::LogLevel::LEVEL, __SSGX__FILENAME__, __LINE__, __FUNCTION__)
23#define SSGX_LOG_IF(LEVEL, CONDITION) !(CONDITION) ? (void)0 : SSGX_LOG(LEVEL)
24
25#ifndef SSGX_FUNC_BEGIN
26#define SSGX_FUNC_BEGIN (SSGX_LOG(INFO) << "Function Begin!");
27#endif
28
29#ifndef SSGX_FUNC_END
30#define SSGX_FUNC_END (SSGX_LOG(INFO) << "Function End!");
31#endif
32
33#include "ssgx_log_t_logger.h"
34
35#endif // SAFEHERON_SGX_LOG_T_H