mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-14 17:30:09 +08:00
Initialize logging
Depends on https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/2424890 Although logging to files is not yet supported by mini_chromium, it is the default behavior for OS_WIN in chromium. This change should cause crashpad to log via OutputDebugString() on Windows, instead of debug.log files. Future work (crbug.com/crashpad/26) should arrange for logs to be uploaded with reports, embedded in associated minidumps or as file attachments. Bug: chromium:711159 Change-Id: I0f9004f7de94dd29d555cc7d23c48a63da6b4bba Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2425108 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
c4c71b80c6
commit
71e8ec7987
2
DEPS
2
DEPS
@ -42,7 +42,7 @@ deps = {
|
||||
'7bde79cc274d06451bf65ae82c012a5d3e476b5a',
|
||||
'crashpad/third_party/mini_chromium/mini_chromium':
|
||||
Var('chromium_git') + '/chromium/mini_chromium@' +
|
||||
'1dbeb82e0452bc1b65f09f767a102cc4648135a4',
|
||||
'5fc64bfbf1c000161445c586de45e40464ff2314',
|
||||
'crashpad/third_party/libfuzzer/src':
|
||||
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git@' +
|
||||
'fda403cf93ecb8792cb1d061564d89a6553ca020',
|
||||
|
@ -504,16 +504,26 @@ class ScopedStoppable {
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedStoppable);
|
||||
};
|
||||
|
||||
void InitCrashpadLogging() {
|
||||
logging::LoggingSettings settings;
|
||||
#if defined(OS_CHROMEOS)
|
||||
settings.logging_dest = logging::LOG_TO_FILE;
|
||||
settings.log_file_path = "/var/log/chrome/chrome";
|
||||
#elif defined(OS_WIN)
|
||||
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
|
||||
#else
|
||||
settings.logging_dest =
|
||||
logging::LOG_TO_SYSTEM_DEBUG_LOG | logging::LOG_TO_STDERR;
|
||||
#endif
|
||||
logging::InitLogging(settings);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int HandlerMain(int argc,
|
||||
char* argv[],
|
||||
const UserStreamDataSources* user_stream_sources) {
|
||||
#if defined(OS_CHROMEOS)
|
||||
if (freopen("/var/log/chrome/chrome", "a", stderr) == nullptr) {
|
||||
PLOG(ERROR) << "Failed to redirect stderr to /var/log/chrome/chrome";
|
||||
}
|
||||
#endif
|
||||
InitCrashpadLogging();
|
||||
|
||||
InstallCrashHandler();
|
||||
CallMetricsRecordNormalExit metrics_record_normal_exit;
|
||||
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "build/build_config.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test/main_arguments.h"
|
||||
@ -99,6 +100,12 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
#endif // CRASHPAD_IS_IN_CHROMIUM
|
||||
|
||||
// base::TestSuite initializes logging when using Chromium's test launcher.
|
||||
logging::LoggingSettings settings;
|
||||
settings.logging_dest =
|
||||
logging::LOG_TO_STDERR | logging::LOG_TO_SYSTEM_DEBUG_LOG;
|
||||
logging::InitLogging(settings);
|
||||
|
||||
#if defined(CRASHPAD_TEST_LAUNCHER_GOOGLEMOCK)
|
||||
testing::InitGoogleMock(&argc, argv);
|
||||
#elif defined(CRASHPAD_TEST_LAUNCHER_GOOGLETEST)
|
||||
|
Loading…
x
Reference in New Issue
Block a user