diff --git a/src/rime/setup.cc b/src/rime/setup.cc index 738f0d80eb..3091838783 100644 --- a/src/rime/setup.cc +++ b/src/rime/setup.cc @@ -80,7 +80,11 @@ RIME_API void SetupLogging(const char* app_name, FLAGS_minloglevel = min_log_level; FLAGS_alsologtostderr = true; if (log_dir) { - FLAGS_log_dir = log_dir; + if (log_dir[0] == '\0') { + FLAGS_logtostderr = true; + } else { + FLAGS_log_dir = log_dir; + } } // Do not allow other users to read/write log files created by current // process. diff --git a/src/rime_api.h b/src/rime_api.h index f36c3a745c..ae4467abc8 100644 --- a/src/rime_api.h +++ b/src/rime_api.h @@ -94,6 +94,7 @@ typedef struct rime_traits_t { int min_log_level; /*! Directory of log files. * Value is passed to Glog library using FLAGS_log_dir variable. + * NULL means temporary directory, and "" means only writing to stderr. */ const char* log_dir; //! prebuilt data directory. defaults to ${shared_data_dir}/build