mirror of https://github.com/milvus-io/milvus.git
parent
e2bf433de9
commit
36268f84dd
|
@ -20,6 +20,7 @@ add_executable(vecwise_engine_server
|
||||||
${config_files}
|
${config_files}
|
||||||
${server_files}
|
${server_files}
|
||||||
${utils_files}
|
${utils_files}
|
||||||
|
${VECWISE_THIRD_PARTY_BUILD}/include/easylogging++.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
set(dependency_libs
|
set(dependency_libs
|
||||||
|
|
|
@ -10,9 +10,13 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <easylogging++.h>
|
||||||
|
|
||||||
#include "utils/SignalUtil.h"
|
#include "utils/SignalUtil.h"
|
||||||
#include "utils/CommonUtil.h"
|
#include "utils/CommonUtil.h"
|
||||||
|
#include "utils/LogUtil.h"
|
||||||
|
|
||||||
|
INITIALIZE_EASYLOGGINGPP
|
||||||
|
|
||||||
void print_help(const std::string &app_name);
|
void print_help(const std::string &app_name);
|
||||||
|
|
||||||
|
@ -20,7 +24,9 @@ using namespace zilliz::vecwise;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
server::CommonUtil::PrintInfo("Vecwise engine server start");
|
zilliz::vecwise::server::InitLog();
|
||||||
|
|
||||||
|
printf("Vecwise engine server start...\n");
|
||||||
|
|
||||||
// zilliz::lib::gpu::InitMemoryAllocator();
|
// zilliz::lib::gpu::InitMemoryAllocator();
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
// Proprietary and confidential.
|
// Proprietary and confidential.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
#include "CommonUtil.h"
|
#include "CommonUtil.h"
|
||||||
|
#include "utils/Log.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
|
@ -31,13 +32,13 @@ namespace server {
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
void CommonUtil::PrintInfo(const std::string& info){
|
void CommonUtil::PrintInfo(const std::string& info){
|
||||||
// SERVER_LOG_INFO << info;
|
SERVER_LOG_INFO << info;
|
||||||
std::cout << info << std::endl;
|
// std::cout << info << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonUtil::PrintError(const std::string& info){
|
void CommonUtil::PrintError(const std::string& info){
|
||||||
// SERVER_LOG_ERROR << info;
|
SERVER_LOG_ERROR << info;
|
||||||
std::cout << info << std::endl;
|
// std::cout << info << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommonUtil::GetSystemMemInfo(unsigned long &totalMem, unsigned long &freeMem) {
|
bool CommonUtil::GetSystemMemInfo(unsigned long &totalMem, unsigned long &freeMem) {
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||||
|
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||||
|
* Proprietary and confidential.
|
||||||
|
******************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Error.h"
|
||||||
|
#include <easylogging++.h>
|
||||||
|
|
||||||
|
namespace zilliz {
|
||||||
|
namespace vecwise {
|
||||||
|
namespace server {
|
||||||
|
|
||||||
|
#define SERVER_DOMAIN_NAME "[SERVER] "
|
||||||
|
#define SERVER_ERROR_TEXT "SERVER Error:"
|
||||||
|
|
||||||
|
#define SERVER_LOG_TRACE LOG(TRACE) << SERVER_DOMAIN_NAME
|
||||||
|
#define SERVER_LOG_DEBUG LOG(DEBUG) << SERVER_DOMAIN_NAME
|
||||||
|
#define SERVER_LOG_INFO LOG(INFO) << SERVER_DOMAIN_NAME
|
||||||
|
#define SERVER_LOG_WARNING LOG(WARNING) << SERVER_DOMAIN_NAME
|
||||||
|
#define SERVER_LOG_ERROR LOG(ERROR) << SERVER_DOMAIN_NAME
|
||||||
|
#define SERVER_LOG_FATAL LOG(FATAL) << SERVER_DOMAIN_NAME
|
||||||
|
|
||||||
|
#define SERVER_ERROR(error) \
|
||||||
|
({ \
|
||||||
|
SERVER_LOG_ERROR << SERVER_ERROR_TEXT << error; \
|
||||||
|
(error); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define SERVER_CHECK(func) \
|
||||||
|
{ \
|
||||||
|
zilliz::vecwise::server::ServerError error = func; \
|
||||||
|
if (error != zilliz::vecwise::server::SERVER_SUCCESS) { \
|
||||||
|
return SERVER_ERROR(error); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
|
||||||
|
} // namespace sql
|
||||||
|
} // namespace zilliz
|
||||||
|
} // namespace server
|
|
@ -0,0 +1,24 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||||
|
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||||
|
// Proprietary and confidential.
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#include "LogUtil.h"
|
||||||
|
|
||||||
|
#include <easylogging++.h>
|
||||||
|
|
||||||
|
namespace zilliz {
|
||||||
|
namespace vecwise {
|
||||||
|
namespace server {
|
||||||
|
|
||||||
|
int32_t InitLog() {
|
||||||
|
el::Configurations conf("../../conf/vecwise_engine_log.conf");
|
||||||
|
el::Loggers::reconfigureAllLoggers(conf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // server
|
||||||
|
} // vecwise
|
||||||
|
} // zilliz
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||||
|
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||||
|
* Proprietary and confidential.
|
||||||
|
******************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace zilliz {
|
||||||
|
namespace vecwise {
|
||||||
|
namespace server {
|
||||||
|
|
||||||
|
int32_t InitLog();
|
||||||
|
|
||||||
|
inline std::string GetFileName(std::string filename) {
|
||||||
|
int pos = filename.find_last_of('/');
|
||||||
|
return filename.substr(pos + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SHOW_LOCATION
|
||||||
|
#ifdef SHOW_LOCATION
|
||||||
|
#define LOCATION_INFO "[" << zilliz::sql::server::GetFileName(__FILE__) << ":" << __LINE__ << "] "
|
||||||
|
#else
|
||||||
|
#define LOCATION_INFO ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
#include "SignalUtil.h"
|
#include "SignalUtil.h"
|
||||||
#include "CommonUtil.h"
|
#include "CommonUtil.h"
|
||||||
#include "server/Server.h"
|
#include "server/Server.h"
|
||||||
|
#include "utils/Log.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
|
|
Loading…
Reference in New Issue