1 /* 2 * Copyright (c) 2023 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 CONTINUATION_MANAGER_LOG_H_ 17 #define CONTINUATION_MANAGER_LOG_H_ 18 19 #include "errors.h" 20 #include "hilog/log_c.h" 21 #include "hilog/log_cpp.h" 22 #include "inttypes.h" 23 24 namespace OHOS { 25 namespace DistributedSchedule { 26 static constexpr OHOS::HiviewDFX::HiLogLabel CONTINUATION_MANAGER_LABEL = {LOG_CORE, 0xD004170, 27 "ContinuationMgrService"}; 28 29 #ifdef HILOGD 30 #undef HILOGD 31 #endif 32 33 #ifdef HILOGF 34 #undef HILOGF 35 #endif 36 37 #ifdef HILOGE 38 #undef HILOGE 39 #endif 40 41 #ifdef HILOGW 42 #undef HILOGW 43 #endif 44 45 #ifdef HILOGI 46 #undef HILOGI 47 #endif 48 49 #define DMS_LOG(level, fmt, ...) HiviewDFX::HiLog::level(CONTINUATION_MANAGER_LABEL, \ 50 "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__) 51 52 #define HILOGF(fmt, ...) DMS_LOG(Fatal, fmt, ##__VA_ARGS__) 53 #define HILOGE(fmt, ...) DMS_LOG(Error, fmt, ##__VA_ARGS__) 54 #define HILOGW(fmt, ...) DMS_LOG(Warn, fmt, ##__VA_ARGS__) 55 #define HILOGI(fmt, ...) DMS_LOG(Info, fmt, ##__VA_ARGS__) 56 #define HILOGD(fmt, ...) DMS_LOG(Debug, fmt, ##__VA_ARGS__) 57 58 enum { 59 /** 60 * Module type: Distributed schedule Service side 61 */ 62 DMS_MODULE_TYPE_SERVICE = 0, 63 }; 64 65 // offset of dms error, only be used in this file. 66 constexpr ErrCode DMS_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDSCHEDULE, DMS_MODULE_TYPE_SERVICE); 67 68 enum { 69 /** 70 * Result(29360128) for invalid parameters. 71 */ 72 INVALID_PARAMETERS_ERR = DMS_SERVICE_ERR_OFFSET, 73 /** 74 * Result(29360141) for dump write file error. 75 */ 76 DMS_WRITE_FILE_FAILED_ERR = 29360141, 77 /** 78 * Result(29360157) for permission denied. 79 */ 80 DMS_PERMISSION_DENIED = 29360157, 81 /* 82 * Result(29360207) for app registered exceed max times. 83 */ 84 REGISTER_EXCEED_MAX_TIMES = 29360207, 85 /* 86 * Result(29360208) for token has not registered. 87 */ 88 TOKEN_HAS_NOT_REGISTERED = 29360208, 89 /* 90 * Result(29360209) for callback has registered. 91 */ 92 CALLBACK_HAS_REGISTERED = 29360209, 93 /* 94 * Result(29360210) for callback has not registered. 95 */ 96 CALLBACK_HAS_NOT_REGISTERED = 29360210, 97 /* 98 * Result(29360211) for connect ability failed. 99 */ 100 CONNECT_ABILITY_FAILED = 29360211, 101 /* 102 * Result(29360212) for disconnect ability failed. 103 */ 104 DISCONNECT_ABILITY_FAILED = 29360212, 105 /* 106 * Result(29360214) for unknown callback type. 107 */ 108 UNKNOWN_CALLBACK_TYPE = 29360214, 109 /* 110 * Result(29360215) for invalid connect status. 111 */ 112 INVALID_CONNECT_STATUS = 29360215, 113 /* 114 * Result(29360216) for invalid continuation mode. 115 */ 116 INVALID_CONTINUATION_MODE = 29360216, 117 }; 118 } // namespace DistributedSchedule 119 } // namespace OHOS 120 #endif // CONTINUATION_MANAGER_LOG_H_ 121