mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
Add log support and tests
Former-commit-id: f946b994174633082110e8d5b26640998e4ed35e
This commit is contained in:
parent
21e95ab5c2
commit
987ff82e10
27
cpp/conf/vecwise_engine_log.conf
Normal file
27
cpp/conf/vecwise_engine_log.conf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
* GLOBAL:
|
||||||
|
FORMAT = "%datetime | %level | %logger | %msg"
|
||||||
|
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-global.log"
|
||||||
|
ENABLED = true
|
||||||
|
TO_FILE = true
|
||||||
|
TO_STANDARD_OUTPUT = true
|
||||||
|
SUBSECOND_PRECISION = 3
|
||||||
|
PERFORMANCE_TRACKING = false
|
||||||
|
MAX_LOG_FILE_SIZE = 2097152 ## Throw log files away after 2MB
|
||||||
|
* DEBUG:
|
||||||
|
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-debug.log"
|
||||||
|
ENABLED = true
|
||||||
|
* WARNING:
|
||||||
|
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-warning.log"
|
||||||
|
* TRACE:
|
||||||
|
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-trace.log"
|
||||||
|
* VERBOSE:
|
||||||
|
FORMAT = "%datetime{%d/%M/%y} | %level-%vlevel | %msg"
|
||||||
|
TO_FILE = false
|
||||||
|
TO_STANDARD_OUTPUT = true
|
||||||
|
## Error logs
|
||||||
|
* ERROR:
|
||||||
|
ENABLED = false
|
||||||
|
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-error.log"
|
||||||
|
* FATAL:
|
||||||
|
ENABLED = false
|
||||||
|
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-fatal.log"
|
@ -4,10 +4,10 @@
|
|||||||
# Proprietary and confidential.
|
# Proprietary and confidential.
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
aux_source_directory(./cache cache_files)
|
aux_source_directory(cache cache_files)
|
||||||
aux_source_directory(./config config_files)
|
aux_source_directory(config config_files)
|
||||||
aux_source_directory(./server server_files)
|
aux_source_directory(server server_files)
|
||||||
aux_source_directory(./utils utils_files)
|
aux_source_directory(utils utils_files)
|
||||||
|
|
||||||
set(vecwise_engine_src
|
set(vecwise_engine_src
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||||
|
@ -9,7 +9,7 @@ link_directories(
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(unittest_srcs
|
set(unittest_srcs
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/vecwise_test.cpp)
|
${CMAKE_CURRENT_SOURCE_DIR}/vecwise_test.cpp ${VECWISE_THIRD_PARTY_BUILD}/include/easylogging++.cc)
|
||||||
|
|
||||||
set(unittest_libs
|
set(unittest_libs
|
||||||
gtest_main
|
gtest_main
|
||||||
|
@ -4,16 +4,17 @@
|
|||||||
// Proprietary and confidential.
|
// Proprietary and confidential.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
#include "easylogging++.h"
|
||||||
|
|
||||||
|
class LogTest: public testing::Test {
|
||||||
|
protected:
|
||||||
|
void SetUp() override {
|
||||||
|
el::Configurations conf("../../../conf/vecwise_engine_log.conf");
|
||||||
|
el::Loggers::reconfigureAllLoggers(conf);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
TEST(LogTest, INIT_TEST) {
|
TEST_F(LogTest, TEST) {
|
||||||
ASSERT_STREQ("A", "A");
|
EXPECT_FALSE(el::Loggers::hasFlag(el::LoggingFlag::NewLineForContainer));
|
||||||
}
|
EXPECT_FALSE(el::Loggers::hasFlag(el::LoggingFlag::LogDetailedCrashReason));
|
||||||
|
|
||||||
TEST(LogTest, RUN_TEST) {
|
|
||||||
ASSERT_STREQ("B", "B");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(LogTest, FINISH_TEST) {
|
|
||||||
ASSERT_STREQ("C", "C");
|
|
||||||
}
|
}
|
@ -5,6 +5,9 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
|
#include <easylogging++.h>
|
||||||
|
|
||||||
|
INITIALIZE_EASYLOGGINGPP
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user