提交 cf7f5596 编写于 作者: G groot

display initial info


Former-commit-id: 2ae5fe00af394147d863e2c1f27dd5ae3989a665
上级 68767a9f
......@@ -47,27 +47,27 @@ LicenseCheck::LegalityCheck(const std::string &license_file_path) {
end_time);
if(err !=SERVER_SUCCESS)
{
printf("License check error: 01\n");
std::cout << "License check error: 01" << std::endl;
return SERVER_UNEXPECTED_ERROR;
}
time_t system_time;
LicenseLibrary::GetSystemTime(system_time);
if (device_count != output_device_count) {
printf("License check error: 02\n");
std::cout << "License check error: 02" << std::endl;
return SERVER_UNEXPECTED_ERROR;
}
for (int i = 0; i < device_count; ++i) {
if (sha_array[i] != uuid_encryption_map[i]) {
printf("License check error: 03\n");
std::cout << "License check error: 03" << std::endl;
return SERVER_UNEXPECTED_ERROR;
}
}
if (system_time < starting_time || system_time > end_time) {
printf("License check error: 04\n");
std::cout << "License check error: 04" << std::endl;
return SERVER_UNEXPECTED_ERROR;
}
printf("Legality Check Success\n");
std::cout << "Legality Check Success" << std::endl;
return SERVER_SUCCESS;
}
......@@ -80,11 +80,11 @@ LicenseCheck::AlterFile(const std::string &license_file_path,
ServerError err = LicenseCheck::LegalityCheck(license_file_path);
if(err!=SERVER_SUCCESS) {
printf("license file check error\n");
std::cout << "license file check error" << std::endl;
exit(1);
}
printf("---runing---\n");
std::cout << "---runing---" << std::endl;
pt->expires_at(pt->expires_at() + boost::posix_time::hours(1));
pt->async_wait(boost::bind(LicenseCheck::AlterFile, license_file_path, boost::asio::placeholders::error, pt));
......@@ -96,7 +96,7 @@ ServerError
LicenseCheck::StartCountingDown(const std::string &license_file_path) {
if (!LicenseLibrary::IsFileExistent(license_file_path)) {
printf("license file not exist\n");
std::cout << "license file not exist" << std::endl;
exit(1);
}
......
......@@ -26,8 +26,8 @@ using namespace zilliz::milvus;
int
main(int argc, char *argv[]) {
printf("\nWelcome to use Milvus by Zillz!\n");
printf("Milvus %s version: v%s built at %s\n", BUILD_TYPE, MILVUS_VERSION, BUILD_TIME);
std::cout << std::endl << "Welcome to use Milvus by Zillz!" << std::endl;
std::cout << "Milvus " << BUILD_TYPE << " version: v" << MILVUS_VERSION << " built at " << BUILD_TIME << std::endl;
signal(SIGINT, server::SignalUtil::HandleSignal);
signal(SIGSEGV, server::SignalUtil::HandleSignal);
......@@ -53,7 +53,7 @@ main(int argc, char *argv[]) {
if(argc < 2) {
print_help(app_name);
printf("Milvus server exit...\n");
std::cout << "Milvus server exit..." << std::endl;
return EXIT_FAILURE;
}
......@@ -64,14 +64,14 @@ main(int argc, char *argv[]) {
char *config_filename_ptr = strdup(optarg);
config_filename = config_filename_ptr;
free(config_filename_ptr);
printf("Loading configuration from: %s\n", config_filename.c_str());
std::cout << "Loading configuration from: " << config_filename << std::endl;
break;
}
case 'l': {
char *log_filename_ptr = strdup(optarg);
log_config_file = log_filename_ptr;
free(log_filename_ptr);
printf("Initial log config from: %s\n", log_config_file.c_str());
std::cout << "Initial log config from: " << log_config_file << std::endl;
break;
}
......@@ -79,7 +79,7 @@ main(int argc, char *argv[]) {
char *pid_filename_ptr = strdup(optarg);
pid_filename = pid_filename_ptr;
free(pid_filename_ptr);
printf("%s\n", pid_filename.c_str());
std::cout << pid_filename << std::endl;
break;
}
......@@ -107,11 +107,11 @@ main(int argc, char *argv[]) {
void
print_help(const std::string &app_name) {
printf("\n Usage: %s [OPTIONS]\n\n", app_name.c_str());
printf(" Options:\n");
printf(" -h --help Print this help\n");
printf(" -c --conf_file filename Read configuration from the file\n");
printf(" -d --daemon Daemonize this application\n");
printf(" -p --pid_file filename PID file used by daemonized app\n");
printf("\n");
std::cout << std::endl<< "Usage: " << app_name << " [OPTIONS]" << std::endl << std::endl;
std::cout << " Options:" << std::endl;
std::cout << " -h --help Print this help" << std::endl;
std::cout << " -c --conf_file filename Read configuration from the file" << std::endl;
std::cout << " -d --daemon Daemonize this application" << std::endl;
std::cout << " -p --pid_file filename PID file used by daemonized app" << std::endl;
std::cout << std::endl;
}
......@@ -171,7 +171,7 @@ Server::Start() {
signal(SIGTERM, SignalUtil::HandleSignal);
server::Metrics::GetInstance().Init();
server::SystemInfo::GetInstance().Init();
printf("Milvus server start successfully.\n");
std::cout << "Milvus server start successfully." << std::endl;
StartService();
} catch(std::exception& ex){
......@@ -187,18 +187,18 @@ Server::Start() {
void
Server::Stop() {
printf("Milvus server is going to shutdown ...\n");
std::cout << "Milvus server is going to shutdown ..." << std::endl;
// Unlock and close lockfile
if (pid_fd != -1) {
int ret = lockf(pid_fd, F_ULOCK, 0);
if(ret != 0){
printf("Can't lock file: %s\n", strerror(errno));
std::cout << "Can't lock file: " << strerror(errno) << std::endl;
exit(0);
}
ret = close(pid_fd);
if(ret != 0){
printf("Can't close file: %s\n", strerror(errno));
std::cout << "Can't close file: " << strerror(errno) << std::endl;
exit(0);
}
}
......@@ -207,7 +207,7 @@ Server::Stop() {
if (!pid_filename_.empty()) {
int ret = unlink(pid_filename_.c_str());
if(ret != 0){
printf("Can't unlink file: %s\n", strerror(errno));
std::cout << "Can't unlink file: " << strerror(errno) << std::endl;
exit(0);
}
}
......@@ -219,7 +219,7 @@ Server::Stop() {
#ifdef ENABLE_LICENSE
server::LicenseCheck::GetInstance().StopCountingDown();
#endif
printf("Milvus server is closed!\n");
std::cout << "Milvus server is closed!" << std::endl;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册