• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
19     static void D(const char* tag, const char* format, ...);
20 
21     static void E(const char* tag, const char* format, ...);
22 
23     static void V(const char* tag, const char* format, ...);
24 
SetLevel(int level)25     inline static void SetLevel(int level)
26     {
27         level_ = level;
28     }
29 
30     static constexpr int VERBOSE = 0;
31     static constexpr int DEBUG = 1;
32     static constexpr int ERROR = 2;
33     static constexpr int NOLOG = 3;
34 
35 private:
36     Logger();
37 
38     ~Logger();
39 
40     static void Log(const char* tag, const char* format, va_list args);
41 
42     static void Err(const char* tag, const char* format, va_list args);
43 
44     static int level_;
45 };
46 } // namespace HDI
47 } // namespace OHOS
48 
49 #endif // OHOS_HDI_LOGGER_H