bsdiff: Change all stderr and perror to LOG(ERROR)
We need to be able to turn off the logging at runtime. When performing fuzz testing, the input data is mostly invalid. But the invalid input data causes all the error logs in the output which is noisy, inefficient, and not necessary. More information can be found in: https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/getting_started.md#disable-noisy-error-message-logging One option to turn off the logging at runtime is: std::cerr.setstate(std::ios_base::failbit); which works but not when we are doing fprintf to stderr. Another option is in the lines of the following: freopen("/dev/null", "w", stderr); But, this seem to disable everything even useful needed logs. This patch, changes all codes (except in bsdiff_main.cc) that logs using fprintf() and perror() to the new uniform form of logging (defined in logging.h). This new logging alternative allows universal manipulation of the logging if necessary. Bug: none Test: unittests pass Change-Id: I42bb3e5856c5c215dd82925ccdca44556124655d
Loading
Please sign in to comment