forked from mindspore-Ecosystem/mindspore
Fix problem caused by MS_CORE_API in LogWriter
This commit is contained in:
parent
16d5427743
commit
f7b5c282ae
|
@ -70,7 +70,7 @@ enum ExceptionType {
|
||||||
NameError
|
NameError
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MS_CORE_API LocationInfo {
|
struct LocationInfo {
|
||||||
LocationInfo(const char *file, int line, const char *func) : file_(file), line_(line), func_(func) {}
|
LocationInfo(const char *file, int line, const char *func) : file_(file), line_(line), func_(func) {}
|
||||||
~LocationInfo() = default;
|
~LocationInfo() = default;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ struct MS_CORE_API LocationInfo {
|
||||||
const char *func_;
|
const char *func_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MS_CORE_API LogStream {
|
class LogStream {
|
||||||
public:
|
public:
|
||||||
LogStream() { sstream_ = std::make_shared<std::stringstream>(); }
|
LogStream() { sstream_ = std::make_shared<std::stringstream>(); }
|
||||||
~LogStream() = default;
|
~LogStream() = default;
|
||||||
|
@ -155,7 +155,7 @@ MS_EXPORT std::string GetTimeString();
|
||||||
|
|
||||||
MS_EXPORT extern int g_ms_submodule_log_levels[];
|
MS_EXPORT extern int g_ms_submodule_log_levels[];
|
||||||
|
|
||||||
class MS_CORE_API LogWriter {
|
class LogWriter {
|
||||||
public:
|
public:
|
||||||
using ExceptionHandler = std::function<void(ExceptionType, const std::string &msg)>;
|
using ExceptionHandler = std::function<void(ExceptionType, const std::string &msg)>;
|
||||||
using TraceProvider = std::function<void(std::ostringstream &oss)>;
|
using TraceProvider = std::function<void(std::ostringstream &oss)>;
|
||||||
|
@ -165,8 +165,8 @@ class MS_CORE_API LogWriter {
|
||||||
: location_(location), log_level_(log_level), submodule_(submodule), exception_type_(excp_type) {}
|
: location_(location), log_level_(log_level), submodule_(submodule), exception_type_(excp_type) {}
|
||||||
~LogWriter() = default;
|
~LogWriter() = default;
|
||||||
|
|
||||||
void operator<(const LogStream &stream) const noexcept;
|
MS_CORE_API void operator<(const LogStream &stream) const noexcept;
|
||||||
[[noreturn]] void operator^(const LogStream &stream) const;
|
MS_CORE_API void operator^(const LogStream &stream) const __attribute__((noreturn));
|
||||||
|
|
||||||
static void set_exception_handler(ExceptionHandler exception_handler) { exception_handler_ = exception_handler; }
|
static void set_exception_handler(ExceptionHandler exception_handler) { exception_handler_ = exception_handler; }
|
||||||
static void set_trace_provider(TraceProvider trace_provider) { trace_provider_ = trace_provider; }
|
static void set_trace_provider(TraceProvider trace_provider) { trace_provider_ = trace_provider; }
|
||||||
|
|
Loading…
Reference in New Issue