trunks: Unify logging location
This CL defaults trunks daemon logging to syslog.
Logs can be forwarded to stderr by passing the --log_to_stderr switch.
trunks_client now logs to stderr by default.
Bug: 25567627
TEST=compile and run on DUT
Change-Id: I072a4c1dab9425f997faa0f68e8eae99f1b383fb
diff --git a/trunks_client.cc b/trunks_client.cc
index 2202107..4975470 100644
--- a/trunks_client.cc
+++ b/trunks_client.cc
@@ -135,7 +135,7 @@
int main(int argc, char **argv) {
base::CommandLine::Init(argc, argv);
- brillo::InitLog(brillo::kLogToSyslog | brillo::kLogToStderr);
+ brillo::InitLog(brillo::kLogToStderr);
base::CommandLine *cl = base::CommandLine::ForCurrentProcess();
if (cl->HasSwitch("help")) {
puts("Trunks Client: A command line tool to access the TPM.");
diff --git a/trunksd.cc b/trunksd.cc
index 4c7b05f..ecb047a 100644
--- a/trunksd.cc
+++ b/trunksd.cc
@@ -112,8 +112,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);
trunks::CommandTransceiver *transceiver;
if (cl->HasSwitch("ftdi")) {
transceiver = new trunks::TrunksFtdiSpi();