Safeheron-SGX-Native-Development-Framework v1.2.0
Loading...
Searching...
No Matches
ssgx_log_u_logger.h
Go to the documentation of this file.
1#ifndef SAFEHERON_SGX_LIBRARY_LOG_U_H
2#define SAFEHERON_SGX_LIBRARY_LOG_U_H
3
4#include <string>
5
7
8namespace ssgx {
9namespace log_u {
10
27 public:
35
48 void Init(const std::string& logger_name, const std::string& log_file,
49 LogLevel log_level = ssgx::log_u::LogLevel::INFO, bool append_console = false);
50
57 std::string GetLoggerName() {
58 return logger_name_;
59 }
60
75 void SetTraceId(const std::string& trace_id);
76
78
94 int WriteLog(ssgx::log_u::LogLevel log_level, const char* msg);
95
96 // Delete copy constructor and assignment operator
97 SSGXLogger(const SSGXLogger&) = delete;
98 SSGXLogger& operator=(const SSGXLogger&) = delete;
99
100 private:
104 SSGXLogger();
105
109 ~SSGXLogger() = default;
110
117 int MapLogLevel(LogLevel log_level) const;
118
119 std::string logger_name_;
120 bool initialized_;
121};
122
123} // namespace log_u
124} // namespace ssgx
125
126#endif // SAFEHERON_SGX_LIBRARY_LOG_U_H
Singleton class for managing logging within the SGX library.
Definition ssgx_log_u_logger.h:26
int WriteLog(ssgx::log_u::LogLevel log_level, const char *msg)
Logs a message with the specified log level.
std::string GetLoggerName()
Retrieves the singleton instance of SSGXLogger.
Definition ssgx_log_u_logger.h:57
void Init(const std::string &logger_name, const std::string &log_file, LogLevel log_level=ssgx::log_u::LogLevel::INFO, bool append_console=false)
Initializes the logger with specified settings.
static SSGXLogger & GetInstance()
Retrieves the singleton instance of SSGXLogger.
SSGXLogger(const SSGXLogger &)=delete
void SetTraceId(const std::string &trace_id)
Sets a trace ID for log messages.
SSGXLogger & operator=(const SSGXLogger &)=delete
LogLevel
Definition ssgx_log_u_log_message.h:8
Definition ssgx_attestation_t.h:6