support default log level on windows 10

This commit is contained in:
chenjianping 2020-04-22 02:24:48 +00:00
parent 72f42fc37c
commit 18d8a1d2d3
3 changed files with 11 additions and 1 deletions

View File

@ -31,6 +31,7 @@ cd %CD%/mindspore
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -G "CodeBlocks - MinGW Makefiles" ../..
IF NOT %errorlevel% == 0 (
echo "cmake fail."
goto run_fail
)
@ -40,6 +41,7 @@ IF "%1%" == "" (
cmake --build . --target package -- -j%1%
)
IF NOT %errorlevel% == 0 (
echo "build fail."
goto run_fail
)
@ -49,6 +51,6 @@ goto run_eof
:run_fail
cd %BASEPATH%
echo "build fail."
set errorlevel=1
:run_eof

View File

@ -31,7 +31,9 @@ CPUKernelFactory &CPUKernelFactory::Get() {
void CPUKernelFactory::Register(const std::string &kernel_name, CPUKernelCreator &&kernel_creator) {
if (kernel_creators_.find(kernel_name) == kernel_creators_.end()) {
(void)kernel_creators_.emplace(kernel_name, kernel_creator);
#if !defined(_WIN32) && !defined(_WIN64)
MS_LOG(DEBUG) << "CPUKernelFactory register operator: " << kernel_name;
#endif
}
}

View File

@ -229,13 +229,19 @@ static void InitMsLogLevel() {
extern "C" {
// shared lib init hook
#if defined(_WIN32) || defined(_WIN64)
__attribute__((constructor)) void mindspore_log_init(void) {
#else
void mindspore_log_init(void) {
#endif
#ifdef USE_GLOG
// do not use glog predefined log prefix
FLAGS_log_prefix = false;
static bool is_glog_initialzed = false;
if (!is_glog_initialzed) {
#if !defined(_WIN32) && !defined(_WIN64)
google::InitGoogleLogging("mindspore");
#endif
is_glog_initialzed = true;
}
// set default log level to WARNING