-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
send formatted msg to glog #5999
Conversation
std::string GetFormatedSerializedError(const std::shared_ptr<cfg::ErrorProto>& error_proto) { | ||
const auto& maybe_error = TRY(FormatErrorStr(error_proto)); | ||
const auto& error_str = maybe_error.GetDataAndErrorProto(error_proto->DebugString()); | ||
return error_str.first; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的调用方式不需要这么迂回,直接返回 maybe_error.Data_YouAreNotAllowedToCallThisFuncOutsideThisFile() 就可以了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的调用方式不需要这么迂回,直接返回 maybe_error.Data_YouAreNotAllowedToCallThisFuncOutsideThisFile() 就可以了
不是吧,这里调用Data_YouAreNotAllowedToCallThisFuncOutsideThisFile这个函数只会返回T data。 这里本来的意思是,如果FormatErrorStr失败了,返回错误栈原来的呈现方式,FormatErrorStr的错误栈就不需要了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦哦,了解了。添加一个注释吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦哦,了解了。添加一个注释吧
已加
@@ -29,6 +29,11 @@ namespace oneflow { | |||
template<typename T, typename Enabled = void> | |||
class Maybe; | |||
|
|||
Maybe<std::string> FormatErrorStr(const std::shared_ptr<cfg::ErrorProto>&); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一行是不是没必要
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一行是不是没必要
后面会调用这个函数,这里提前声明一下。否则需要include一下声明这个函数的文件(目前没有声明,只有定义)。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一行是不是没必要
太多文件编译依赖maybe.h,如果include的方式,被include的文件的改动,会造成大量重新编译。
Speed stats:
|
效果图:
