attestation: Unify logging location
This CL defaults attestation daemon logging to syslog.
Logs can be forwared to stderr by passing the --log_to_stderr flag.
Attestation_client now logs by default to stderr.
Bug: 25567627
TEST=None
Change-Id: If87ceffcc48651ff69a0bdd187b7365296ab33a9
diff --git a/client/main.cc b/client/main.cc
index abb3e4e..868b42c 100644
--- a/client/main.cc
+++ b/client/main.cc
@@ -497,7 +497,7 @@
int main(int argc, char* argv[]) {
base::CommandLine::Init(argc, argv);
- brillo::InitLog(brillo::kLogToSyslog | brillo::kLogToStderr);
+ brillo::InitLog(brillo::kLogToStderr);
attestation::ClientLoop loop;
return loop.Run();
}
diff --git a/server/main.cc b/server/main.cc
index 3b001f4..b22ba18 100644
--- a/server/main.cc
+++ b/server/main.cc
@@ -100,7 +100,12 @@
int main(int argc, char* argv[]) {
base::CommandLine::Init(argc, argv);
- brillo::InitLog(brillo::kLogToSyslog | brillo::kLogToStderr);
+ base::CommandLine *cl = base::CommandLine::ForCurrentProcess();
+ int flags = brillo::kLogToSyslog;
+ if (cl->HasSwitch("log_to_stderr")) {
+ flags |= brillo::kLogToStderr;
+ }
+ brillo::InitLog(flags);
AttestationDaemon daemon;
LOG(INFO) << "Attestation Daemon Started.";
InitMinijailSandbox();