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 CGROUP_SCHED_COMMON_INCLUDE_CGROUP_SCHED_LOG_H_ 17 #define CGROUP_SCHED_COMMON_INCLUDE_CGROUP_SCHED_LOG_H_ 18 19 #include <string> 20 #include <vector> 21 #include "hilog/log.h" 22 23 #undef LOG_DOMAIN 24 #define LOG_DOMAIN 0xD001702 25 26 #undef LOG_TAG 27 #define LOG_TAG "CGS" 28 29 #define CGS_LOGD(...) HILOG_DEBUG(LOG_CORE, __VA_ARGS__) 30 #define CGS_LOGI(...) HILOG_INFO(LOG_CORE, __VA_ARGS__) 31 #define CGS_LOGW(...) HILOG_WARN(LOG_CORE, __VA_ARGS__) 32 #define CGS_LOGE(...) HILOG_ERROR(LOG_CORE, __VA_ARGS__) 33 #define CGS_LOGF(...) HILOG_FATAL(LOG_CORE, __VA_ARGS__) 34 35 namespace OHOS { 36 namespace ResourceSchedule { 37 class CgroupSchedLog { 38 public: 39 CgroupSchedLog() = delete; 40 ~CgroupSchedLog() = delete; 41 42 /** 43 * @brief Judge level. 44 * 45 * @param level The level. 46 * @return True if success,else false. 47 */ 48 static bool JudgeLevel(const LogLevel &level); 49 50 /** 51 * @brief Get log level. 52 * 53 * @return Level. 54 */ GetLogLevel()55 static const LogLevel &GetLogLevel() 56 { 57 return level_; 58 } 59 60 private: 61 static LogLevel level_; 62 }; 63 } // namespace ResourceSchedule 64 } // namespace OHOS 65 66 #endif // CGROUP_SCHED_COMMON_INCLUDE_CGROUP_SCHED_LOG_H_ 67