| 26 | } |
| 27 | |
| 28 | void InitFlags(std::string confpath) { |
| 29 | // init FLAGS_flagfile |
| 30 | if (IsExist(confpath)) { |
| 31 | FLAGS_flagfile = confpath; |
| 32 | } else if (IsExist("./tera.flag")) { |
| 33 | FLAGS_flagfile = "./tera.flag"; |
| 34 | } else { |
| 35 | LOG(FATAL) << "tera.flag not exist, job failed."; |
| 36 | } |
| 37 | |
| 38 | // init user identity & role |
| 39 | std::string cur_identity = tera::utils::GetValueFromEnv("USER"); |
| 40 | if (cur_identity.empty()) { |
| 41 | cur_identity = "other"; |
| 42 | } |
| 43 | if (FLAGS_tera_user_identity.empty()) { |
| 44 | FLAGS_tera_user_identity = cur_identity; |
| 45 | } |
| 46 | |
| 47 | // init log dir |
| 48 | if (FLAGS_log_dir.empty()) { |
| 49 | FLAGS_log_dir = "./"; |
| 50 | } |
| 51 | ::google::ReadFromFlagsFile(FLAGS_flagfile, NULL, true); |
| 52 | LOG(INFO) << "USER = " << FLAGS_tera_user_identity; |
| 53 | LOG(INFO) << "Load config file: " << FLAGS_flagfile; |
| 54 | } |
| 55 | |
| 56 | void InitGlog(std::string prefix) { ::google::InitGoogleLogging(prefix.c_str()); } |
| 57 |
nothing calls this directly
no test coverage detected