1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_IDL_LOGGER_H 17 #define OHOS_IDL_LOGGER_H 18 19 #include <cstdarg> 20 21 namespace OHOS { 22 namespace Idl { 23 class Logger { 24 public: 25 static void D(const char *tag, const char *format, ...); 26 27 static void E(const char *tag, const char *format, ...); 28 29 static void V(const char *tag, const char *format, ...); 30 SetLevel(int level)31 inline static void SetLevel(int level) 32 { 33 level_ = level; 34 } 35 36 static constexpr int VERBOSE = 0; 37 static constexpr int DEBUG = 1; 38 static constexpr int ERROR = 2; 39 static constexpr int NOLOG = 3; 40 41 private: 42 Logger(); 43 44 ~Logger(); 45 46 static void Log(const char *tag, const char *format, va_list args); 47 48 static void Err(const char *tag, const char *format, va_list args); 49 50 static int level_; 51 }; 52 } // namespace Idl 53 } // namespace OHOS 54 55 #endif // OHOS_IDL_LOGGER_H