metrics_daemon: log to syslog
Also log to stderr when not running as daemon. BUG=chromium:364700 TEST=manually verified in both daemon and non-daemon modes Change-Id: If62f70c1d327a5ecaf3075b6689b83a1494c09d5 Reviewed-on: https://chromium-review.googlesource.com/199380 Tested-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Daniel Erat <derat@chromium.org> Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
This commit is contained in:
parent
d884a2e478
commit
254d22e5fd
2 changed files with 8 additions and 4 deletions
|
@ -928,8 +928,6 @@ void MetricsDaemon::ReportDailyUse(int use_seconds) {
|
|||
|
||||
void MetricsDaemon::SendSample(const string& name, int sample,
|
||||
int min, int max, int nbuckets) {
|
||||
DLOG(INFO) << "received metric: " << name << " " << sample << " "
|
||||
<< min << " " << max << " " << nbuckets;
|
||||
metrics_lib_->SendToUMA(name, sample, min, max, nbuckets);
|
||||
}
|
||||
|
||||
|
@ -993,8 +991,6 @@ void MetricsDaemon::SendCrashFrequencySample(
|
|||
|
||||
void MetricsDaemon::SendLinearSample(const string& name, int sample,
|
||||
int max, int nbuckets) {
|
||||
DLOG(INFO) << "received linear metric: " << name << " " << sample << " "
|
||||
<< max << " " << nbuckets;
|
||||
// TODO(semenzato): add a proper linear histogram to the Chrome external
|
||||
// metrics API.
|
||||
LOG_IF(FATAL, nbuckets != max + 1) << "unsupported histogram scale";
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
|
||||
#include <base/command_line.h>
|
||||
#include <base/logging.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <chromeos/syslog_logging.h>
|
||||
#include <gflags/gflags.h>
|
||||
#include <rootdev/rootdev.h>
|
||||
|
||||
|
@ -43,7 +45,13 @@ const std::string MetricsMainDiskStatsPath() {
|
|||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
CommandLine::Init(argc, argv);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
// Also log to stderr when not running as daemon.
|
||||
chromeos::InitLog(chromeos::kLogToSyslog | chromeos::kLogHeader |
|
||||
(FLAGS_daemon ? 0 : chromeos::kLogToStderr));
|
||||
|
||||
MetricsLibrary metrics_lib;
|
||||
metrics_lib.Init();
|
||||
MetricsDaemon daemon;
|
||||
|
|
Loading…
Reference in a new issue