1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef OHOS_HDI_LOGGER_H 10 #define OHOS_HDI_LOGGER_H 11 12 #include <cstdarg> 13 14 namespace OHOS { 15 namespace HDI { 16 class Logger { 17 public: 18 static void D(const char *tag, const char *format, ...); 19 20 static void E(const char *tag, const char *format, ...); 21 22 static void V(const char *tag, const char *format, ...); 23 SetLevel(int level)24 inline static void SetLevel(int level) 25 { 26 level_ = level; 27 } 28 29 static constexpr int VERBOSE = 0; 30 static constexpr int DEBUG = 1; 31 static constexpr int ERROR = 2; 32 static constexpr int NOLOG = 3; 33 34 private: 35 Logger(); 36 37 ~Logger(); 38 39 static void Log(const char *tag, const char *format, va_list args); 40 41 static void Err(const char *tag, const char *format, va_list args); 42 43 static int level_; 44 }; 45 } // namespace HDI 46 } // namespace OHOS 47 48 #endif // OHOS_HDI_LOGGER_H