Make C++ log level configurable and add log configuration while building embedded milvus. (#15743)

Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>
This commit is contained in:
Nemo 2022-03-01 10:15:55 +08:00 committed by GitHub
parent 26544fb77f
commit a77e0562b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -9,6 +9,11 @@
# 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
option( EMBEDDED_MILVUS "Enable embedded Milvus" OFF )
if ( EMBEDDED_MILVUS )
add_compile_definitions( "-DEMBEDDED_MILVUS" )
endif()
set(SEGCORE_FILES
Collection.cpp

View File

@ -18,6 +18,18 @@ namespace milvus::segcore {
extern "C" void
SegcoreInit() {
milvus::config::KnowhereInitImpl();
#if defined(EMBEDDED_MILVUS)
el::Configurations defaultConf;
defaultConf.setToDefault();
// Disable all logs for embedded milvus.
defaultConf.set(el::Level::Trace, el::ConfigurationType::Enabled, "false");
defaultConf.set(el::Level::Debug, el::ConfigurationType::Enabled, "false");
defaultConf.set(el::Level::Info, el::ConfigurationType::Enabled, "false");
defaultConf.set(el::Level::Warning, el::ConfigurationType::Enabled, "false");
defaultConf.set(el::Level::Error, el::ConfigurationType::Enabled, "false");
defaultConf.set(el::Level::Fatal, el::ConfigurationType::Enabled, "false");
el::Loggers::reconfigureLogger("default", defaultConf);
#endif
}
extern "C" void

View File

@ -55,8 +55,9 @@ GPU_VERSION="OFF" #defaults to CPU version
WITH_PROMETHEUS="ON"
CUDA_ARCH="DEFAULT"
CUSTOM_THIRDPARTY_PATH=""
EMBEDDED_MILVUS="OFF"
while getopts "p:d:t:s:f:ulrcghzme" arg; do
while getopts "p:d:t:s:f:ulrcghzmeb" arg; do
case $arg in
f)
CUSTOM_THIRDPARTY_PATH=$OPTARG
@ -97,6 +98,9 @@ while getopts "p:d:t:s:f:ulrcghzme" arg; do
s)
CUDA_ARCH=$OPTARG
;;
b)
EMBEDDED_MILVUS=$OPTARG
;;
h) # help
echo "
@ -113,10 +117,11 @@ parameter:
-g: build GPU version(default: OFF)
-e: build without prometheus(default: OFF)
-s: build with CUDA arch(default:DEFAULT), for example '-gencode=compute_61,code=sm_61;-gencode=compute_75,code=sm_75'
-b: build embedded milvus(default: OFF)
-h: help
usage:
./core_build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} -s \${CUDA_ARCH} -f\${CUSTOM_THIRDPARTY_PATH} [-u] [-l] [-r] [-c] [-z] [-g] [-m] [-e] [-h]
./core_build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} -s \${CUDA_ARCH} -f\${CUSTOM_THIRDPARTY_PATH} [-u] [-l] [-r] [-c] [-z] [-g] [-m] [-e] [-h] [-b]
"
exit 0
;;
@ -171,6 +176,7 @@ CMAKE_CMD="cmake \
-DMILVUS_WITH_PROMETHEUS=${WITH_PROMETHEUS} \
-DMILVUS_CUDA_ARCH=${CUDA_ARCH} \
-DCUSTOM_THIRDPARTY_DOWNLOAD_PATH=${CUSTOM_THIRDPARTY_PATH} \
-DEMBEDDED_MILVUS=${EMBEDDED_MILVUS} \
${CPP_SRC_DIR}"
echo ${CMAKE_CMD}
${CMAKE_CMD}