summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUtkarsh Sanghi <usanghi@google.com>2015-11-09 09:22:27 -0800
committerUtkarsh Sanghi <usanghi@google.com>2015-11-09 09:22:27 -0800
commit01f41a46e8a9e0b8d4518aaf7aa757e83f4f938f (patch)
treeef7f3734b3fb6a62c70932937b3c09fcebbbafea
parent38e6ef38e5ee4c7f735366a26111e97a7759f26e (diff)
downloadtpm-01f41a46e8a9e0b8d4518aaf7aa757e83f4f938f.tar.gz
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
-rw-r--r--trunks_client.cc2
-rw-r--r--trunksd.cc6
2 files changed, 6 insertions, 2 deletions
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 DumpStatus(TrunksFactory* factory) {
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 @@ class TrunksDaemon : public brillo::DBusServiceDaemon {
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();