Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2159)

Unified Diff: crash_reporter.cc

Issue 6517001: crash-reporter: Use standard logging and new libchromeos Process code (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crash-reporter.git@master
Patch Set: sync Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Makefile ('K') | « crash_collector_test.cc ('k') | kernel_collector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crash_reporter.cc
diff --git a/crash_reporter.cc b/crash_reporter.cc
index ab4c5ba3bfe6a8bd590346260ba0c401021743ea..64208a71a7634a3e67fbabbc53b57a5a27db908e 100644
--- a/crash_reporter.cc
+++ b/crash_reporter.cc
@@ -8,8 +8,8 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/string_util.h"
+#include "chromeos/syslog_logging.h"
#include "crash-reporter/kernel_collector.h"
-#include "crash-reporter/system_logging.h"
#include "crash-reporter/unclean_shutdown_collector.h"
#include "crash-reporter/user_collector.h"
#include "gflags/gflags.h"
@@ -41,7 +41,6 @@ enum CrashKinds {
};
static MetricsLibrary s_metrics_lib;
-static SystemLoggingImpl s_system_log;
static bool IsFeedbackAllowed() {
return s_metrics_lib.AreMetricsEnabled();
@@ -96,9 +95,7 @@ static void CountUserCrash() {
// to be restarted anyway.
int status = system(command.c_str());
- if (status != 0) {
- s_system_log.LogWarning("dbus-send running failed");
- }
+ LOG_IF(WARNING, status != 0) << "dbus-send running failed";
}
static int Initialize(KernelCollector *kernel_collector,
@@ -149,10 +146,10 @@ static int HandleUserCrash(UserCollector *user_collector) {
}
// Accumulate logs to help in diagnosing failures during user collection.
- s_system_log.set_accumulating(true);
+ syslog_logging::AccumulateToString(true);
// Handle the crash, get the name of the process from procfs.
bool handled = user_collector->HandleCrash(FLAGS_user, NULL);
- s_system_log.set_accumulating(false);
+ syslog_logging::AccumulateToString(false);
if (!handled)
return 1;
return 0;
@@ -184,25 +181,19 @@ int main(int argc, char *argv[]) {
file_util::AbsolutePath(&my_path);
s_metrics_lib.Init();
CommandLine::Init(argc, argv);
- logging::InitLogging(NULL,
- logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
- logging::DONT_LOCK_LOG_FILE,
- logging::DELETE_OLD_LOG_FILE);
- s_system_log.Initialize(my_path.BaseName().value().c_str());
+ syslog_logging::OpenLog(my_path.BaseName().value().c_str(), true);
+ syslog_logging::InitLogging(true, false);
KernelCollector kernel_collector;
kernel_collector.Initialize(CountKernelCrash,
- IsFeedbackAllowed,
- &s_system_log);
+ IsFeedbackAllowed);
UserCollector user_collector;
user_collector.Initialize(CountUserCrash,
my_path.value(),
IsFeedbackAllowed,
- &s_system_log,
true); // generate_diagnostics
UncleanShutdownCollector unclean_shutdown_collector;
unclean_shutdown_collector.Initialize(CountUncleanShutdown,
- IsFeedbackAllowed,
- &s_system_log);
+ IsFeedbackAllowed);
if (FLAGS_init) {
return Initialize(&kernel_collector,
« Makefile ('K') | « crash_collector_test.cc ('k') | kernel_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698