• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 COMMON_COMPONENTS_LOG_LOG_BASE_H
17 #define COMMON_COMPONENTS_LOG_LOG_BASE_H
18 
19 #include <cstdint>
20 #include <iostream>
21 #include <sstream>
22 
23 #include "common_interfaces/base/common.h"
24 
25 enum class Level: uint8_t {
26     VERBOSE,
27     DEBUG,
28     INFO,
29     WARN,
30     ERROR,
31     FATAL_WITHOUT_ABORT,
32     FATAL,
33 };
34 
35 using ComponentMark = uint64_t;
36 enum class Component: uint64_t {
37     NONE = 0ULL,
38     GC = 1ULL << 0ULL,
39     INTERPRETER = 1ULL << 1ULL,
40     COMPILER = 1ULL << 2ULL,
41     DEBUGGER = 1ULL << 3ULL,
42     ECMASCRIPT = 1ULL << 4ULL,
43     BUILTINS = 1ULL << 5ULL,
44     TRACE = 1ULL << 6ULL,
45     JIT = 1UL << 7ULL,
46     BASELINEJIT = 1UL << 8ULL,
47     SA = 1ULL << 9ULL,
48     PGO = 1ULL << 10ULL,
49     COMMON = 1ULL << 11ULL,
50     NO_TAG = 0xFFFFFFFFULL >> 1ULL,
51     ALL = 0xFFFFFFFFULL,
52 };
53 
54 namespace common {
55 #ifdef ENABLE_HILOG
56 
57 #if ECMASCRIPT_ENABLE_VERBOSE_LEVEL_LOG
58 // print Debug level log if enable Verbose log
59 #define LOG_VERBOSE LOG_DEBUG
60 #else
61 #define LOG_VERBOSE LOG_LEVEL_MIN
62 #endif
63 #endif  // ENABLE_HILOG
64 
65 struct LogOptions {
66     Level level;
67     ComponentMark component;
68 };
69 }  // namespace common
70 
71 #endif  // COMMON_COMPONENTS_LOG_LOG_BASE_H
72