1 /** 2 * Copyright 2019-2023 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef MINDSPORE_LITE_SRC_COMMON_LOG_ADAPTER_H_ 17 #define MINDSPORE_LITE_SRC_COMMON_LOG_ADAPTER_H_ 18 19 #ifdef USE_GLOG 20 #include "utils/log_adapter.h" 21 #else 22 #include "src/common/log.h" 23 #endif // USE_GLOG 24 #include "src/common/log_util.h" 25 26 namespace mindspore { 27 const char *const unsupport_string_tensor_log = 28 "This mindspore-lite library does not support string tensors. Set environment variable MSLITE_ENABLE_STRING_KERNEL " 29 "to on to " 30 "recompile it."; 31 const char *const unsupport_controlflow_tensorlist_log = 32 "This mindspore-lite library does not support controlflow and tensorlist op. Set environment variable " 33 "MSLITE_ENABLE_CONTROLFLOW to on to recompile it."; 34 const char *const unsupport_auto_parallel_log = 35 "The mindspore-lite library does not support auto parallel. Set environment variable MSLITE_ENABLE_AUTO_PARALLEL to " 36 "on to " 37 "recompile it."; 38 const char *const unsupport_weight_decode_log = 39 "The mindspore-lite library does not support weight decode. Set environment variable MSLITE_ENABLE_WEIGHT_DECODE to " 40 "on to " 41 "recompile it."; 42 const char *const unsupport_custom_kernel_register_log = 43 "The mindspore-lite library does not support custom kernel register. Set environment variable " 44 "MSLITE_ENABLE_CUSTOM_KERNEL to on to " 45 "recompile it."; 46 const char *const unsupport_delegate_log = 47 "The mindspore-lite library does not support delegate. Set environment variable " 48 "MSLITE_ENABLE_DELEGATE to on to " 49 "recompile it."; 50 const char *const unsupport_fp16_log = 51 "The mindspore-lite library does not support fp16. Set environment variable " 52 "MSLITE_ENABLE_FP16 to on to " 53 "recompile it."; 54 const char *const unsupport_int8_log = 55 "The mindspore-lite library does not support int8. Set environment variable " 56 "MSLITE_ENABLE_INT8 to on to " 57 "recompile it."; 58 IsPrintDebug()59static inline bool IsPrintDebug() { 60 auto env = std::getenv("GLOG_v"); 61 return env != nullptr && env[0] == '0'; 62 } 63 } // namespace mindspore 64 65 #endif // MINDSPORE_LITE_SRC_COMMON_LOG_ADAPTER_H_ 66