Skip to content

Commit

Permalink
allow only logging to stderr with minloglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Oct 8, 2023
1 parent 7928a7d commit 6d1b9b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rime/setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/rime_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d1b9b6

Please sign in to comment.