forked from mindspore-Ecosystem/mindspore
Fix a logging api bug in MindAPI
This commit is contained in:
parent
1f21dd9ae1
commit
93328bc707
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2021 Huawei Technologies Co., Ltd
|
||||
* Copyright 2021-2022 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -37,7 +37,7 @@ class LogStream {
|
|||
/// \param[in] value The object to be written.
|
||||
template <typename T>
|
||||
LogStream &operator<<(T &&value) noexcept {
|
||||
(void)stream_.operator<<(std::forward<T>(value));
|
||||
stream_ << (std::forward<T>(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -407,10 +407,14 @@ TEST_F(TestMindApi, test_api_utils) {
|
|||
/// Description: test logging API.
|
||||
/// Expectation: logging work as expected.
|
||||
TEST_F(TestMindApi, test_api_logging) {
|
||||
std::string name = "mindspore";
|
||||
MS_LOG(DEBUG) << "hello debug";
|
||||
MS_LOG(INFO) << "hello info";
|
||||
MS_LOG(WARNING) << "hello warning";
|
||||
MS_LOG(ERROR) << "hello error";
|
||||
MS_LOG(ERROR) << name;
|
||||
MS_LOG(ERROR) << "hello " << name;
|
||||
MS_LOG(ERROR) << name << " hello";
|
||||
try {
|
||||
MS_LOG(EXCEPTION) << "hello exception";
|
||||
ASSERT_TRUE(false);
|
||||
|
|
Loading…
Reference in New Issue