VisualDL icon indicating copy to clipboard operation
VisualDL copied to clipboard

logging enable error message output

Open Superjomn opened this issue 8 years ago • 4 comments

The logging.h has naive implementations for the interfaces of GLOG, but the CHECKs can not output error messages before exceptions.

This is annoying to users and results in many troubles.

TODO:

  • output the error message

Superjomn avatar Jan 24 '18 09:01 Superjomn

@Superjomn The LogStreamFatal constructor throws errors and there is no way to have the string(extra error message) piped into the message. I noticed that the destructor also throws the exceptions. If we remove the throw Error(ss.str()); in LogStreamFatal constructor, it should be able to print out the error message. It seems the implementation was there already but not confirmed. Was there any concern on doing the throw at the destructor level?

jetfuel avatar Jan 26 '18 01:01 jetfuel

The exception in the construction is just a temporary implementation. The exception in the destruction seems work, but it fails to break the execution of the program at the position where CHECK fails, the exceptions will not be threw until the end of the block (when the destruction is called).

Superjomn avatar Jan 26 '18 15:01 Superjomn

@Superjomn I now see the concern and reason why we switch to the implementation of throwing in the constructor.

I now have another question. We are thinking if it is possible to change the CHECK function to something like CHECK(cond, error_msg). However, I noticed that we are using the GLOG in the debug and we are using our own CHECK Macros in the release mode.

Is this because the GLOG doesn't throw errors? and we wish to capture the errors immediately in the release mode? And is that why we implement our own CHECK functions and can't change the way we call CHECK functions? Sorry for all the questions. We are hoping to have a better understanding of the situation and provide better solutions.

jetfuel avatar Jan 29 '18 19:01 jetfuel

close outdated issue.

PeterPanZH avatar Jun 28 '20 06:06 PeterPanZH