mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-16 21:51:31 +08:00
[Other] Enable to hidden INFO/WARNING log informations (#1368)
* Enable to hidden INFO/WARNING log informations * Fix build error --------- Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com>
This commit is contained in:
@@ -43,6 +43,9 @@ namespace fastdeploy {
|
||||
|
||||
class FASTDEPLOY_DECL FDLogger {
|
||||
public:
|
||||
static bool enable_info;
|
||||
static bool enable_warning;
|
||||
|
||||
FDLogger() {
|
||||
line_ = "";
|
||||
prefix_ = "[FastDeploy]";
|
||||
@@ -90,11 +93,12 @@ FASTDEPLOY_DECL bool ReadBinaryFromFile(const std::string& file,
|
||||
<< __REL_FILE__ << "(" << __LINE__ << ")::" << __FUNCTION__ << "\t"
|
||||
|
||||
#define FDWARNING \
|
||||
FDLogger(true, "[WARNING]") \
|
||||
FDLogger(fastdeploy::FDLogger::enable_warning, "[WARNING]") \
|
||||
<< __REL_FILE__ << "(" << __LINE__ << ")::" << __FUNCTION__ << "\t"
|
||||
|
||||
#define FDINFO \
|
||||
FDLogger(true, "[INFO]") << __REL_FILE__ << "(" << __LINE__ \
|
||||
FDLogger(fastdeploy::FDLogger::enable_info, "[INFO]") \
|
||||
<< __REL_FILE__ << "(" << __LINE__ \
|
||||
<< ")::" << __FUNCTION__ << "\t"
|
||||
|
||||
#define FDASSERT(condition, format, ...) \
|
||||
@@ -214,6 +218,10 @@ std::string Str(const std::vector<T>& shape) {
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
/// Set behaviour of logging while using FastDeploy
|
||||
FASTDEPLOY_DECL void SetLogger(bool enable_info = true,
|
||||
bool enable_warning = true);
|
||||
|
||||
template <typename T>
|
||||
void CalculateStatisInfo(const void* src_ptr, int size, double* mean,
|
||||
double* max, double* min) {
|
||||
|
Reference in New Issue
Block a user