提交 32deb694 编写于 作者: J jinhai

Merge branch 'Refactor_Knowhere' into 'branch-0.5.0'

MS-573 Enable log in knowhere

See merge request megasearch/milvus!589

Former-commit-id: 9868adb9ddc12f9b4bf665ab9ff827366a70bc72
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "utils/easylogging++.h"
namespace zilliz {
namespace knowhere {
#define KNOWHERE_DOMAIN_NAME "[KNOWHERE] "
#define KNOWHERE_ERROR_TEXT "KNOWHERE Error:"
#define KNOWHERE_LOG_TRACE LOG(TRACE) << KNOWHERE_DOMAIN_NAME
#define KNOWHERE_LOG_DEBUG LOG(DEBUG) << KNOWHERE_DOMAIN_NAME
#define KNOWHERE_LOG_INFO LOG(INFO) << KNOWHERE_DOMAIN_NAME
#define KNOWHERE_LOG_WARNING LOG(WARNING) << KNOWHERE_DOMAIN_NAME
#define KNOWHERE_LOG_ERROR LOG(ERROR) << KNOWHERE_DOMAIN_NAME
#define KNOWHERE_LOG_FATAL LOG(FATAL) << KNOWHERE_DOMAIN_NAME
} // namespace knowhere
} // namespace zilliz
\ No newline at end of file
......@@ -19,6 +19,7 @@
#include <cstdio>
#include "exception.h"
#include "Log.h"
namespace zilliz {
namespace knowhere {
......
......@@ -22,6 +22,9 @@ set(basic_libs
gomp gfortran pthread
)
set(util_srcs
${MILVUS_ENGINE_SRC}/utils/easylogging++.cc
)
#<IVF-TEST>
set(ivf_srcs
......@@ -36,7 +39,7 @@ set(ivf_srcs
utils.cpp
)
if(NOT TARGET test_ivf)
add_executable(test_ivf test_ivf.cpp ${ivf_srcs})
add_executable(test_ivf test_ivf.cpp ${ivf_srcs} ${util_srcs})
endif()
target_link_libraries(test_ivf ${depend_libs} ${unittest_libs} ${basic_libs})
......@@ -53,7 +56,7 @@ set(idmap_srcs
utils.cpp
)
if(NOT TARGET test_idmap)
add_executable(test_idmap test_idmap.cpp ${idmap_srcs})
add_executable(test_idmap test_idmap.cpp ${idmap_srcs} ${util_srcs})
endif()
target_link_libraries(test_idmap ${depend_libs} ${unittest_libs} ${basic_libs})
......@@ -70,7 +73,7 @@ set(kdt_srcs
utils.cpp
)
if(NOT TARGET test_kdt)
add_executable(test_kdt test_kdt.cpp ${kdt_srcs})
add_executable(test_kdt test_kdt.cpp ${kdt_srcs} ${util_srcs})
endif()
target_link_libraries(test_kdt
SPTAGLibStatic
......
......@@ -34,6 +34,7 @@ if(NOT TARGET test_nsg)
test_nsg.cpp
${interface_src}
${nsg_src}
${util_srcs}
)
endif()
......
......@@ -18,6 +18,15 @@
#include "utils.h"
INITIALIZE_EASYLOGGINGPP
void InitLog() {
el::Configurations defaultConf;
defaultConf.setToDefault();
defaultConf.set(el::Level::Debug,
el::ConfigurationType::Format, "[%thread-%datetime-%level]: %msg (%fbase:%line)");
el::Loggers::reconfigureLogger("default", defaultConf);
}
void DataGen::Init_with_default() {
Generate(dim, nb, nq);
......
......@@ -24,6 +24,7 @@
#include <fstream>
#include "knowhere/adapter/structure.h"
#include "knowhere/common/Log.h"
class DataGen {
protected:
......@@ -65,6 +66,8 @@ extern void GenBase(const int64_t &dim,
float *xb,
int64_t *ids);
extern void InitLog();
zilliz::knowhere::DatasetPtr
generate_dataset(int64_t nb, int64_t dim, float *xb, long *ids);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册