1 /* 2 * Copyright (c) 2021 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 FRAMEWORKS_WM_INCLUDE_WINDOW_MANAGER_HILOG_H 17 #define FRAMEWORKS_WM_INCLUDE_WINDOW_MANAGER_HILOG_H 18 19 #include "hilog/log.h" 20 namespace OHOS { 21 static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, 0, "WMService" }; 22 23 #define WMLOG_F(...) (void)OHOS::HiviewDFX::HiLog::Fatal(LOG_LABEL, __VA_ARGS__) 24 #define WMLOG_E(...) (void)OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, __VA_ARGS__) 25 #define WMLOG_W(...) (void)OHOS::HiviewDFX::HiLog::Warn(LOG_LABEL, __VA_ARGS__) 26 #define WMLOG_I(...) (void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, __VA_ARGS__) 27 #define WMLOG_D(...) (void)OHOS::HiviewDFX::HiLog::Debug(LOG_LABEL, __VA_ARGS__) 28 29 #define _WM_DFUNC HiviewDFX::HiLog::Debug 30 #define _WM_IFUNC HiviewDFX::HiLog::Info 31 #define _WM_WFUNC HiviewDFX::HiLog::Warn 32 #define _WM_EFUNC HiviewDFX::HiLog::Error 33 34 #define _WM_CPRINTF(func, fmt, ...) func(LABEL, "<%{public}d>" fmt, __LINE__, ##__VA_ARGS__) 35 36 #define WMLOGD(fmt, ...) _WM_CPRINTF(_WM_DFUNC, fmt, ##__VA_ARGS__) 37 #define WMLOGI(fmt, ...) _WM_CPRINTF(_WM_IFUNC, fmt, ##__VA_ARGS__) 38 #define WMLOGW(fmt, ...) _WM_CPRINTF(_WM_WFUNC, fmt, ##__VA_ARGS__) 39 #define WMLOGE(fmt, ...) _WM_CPRINTF(_WM_EFUNC, fmt, ##__VA_ARGS__) 40 41 #define _WM_FUNC __func__ 42 43 #define WMLOGFD(fmt, ...) WMLOGD("%{public}s: " fmt, _WM_FUNC, ##__VA_ARGS__) 44 #define WMLOGFI(fmt, ...) WMLOGI("%{public}s: " fmt, _WM_FUNC, ##__VA_ARGS__) 45 #define WMLOGFW(fmt, ...) WMLOGW("%{public}s: " fmt, _WM_FUNC, ##__VA_ARGS__) 46 #define WMLOGFE(fmt, ...) WMLOGE("%{public}s: " fmt, _WM_FUNC, ##__VA_ARGS__) 47 } // namespace OHOS 48 49 #endif // FRAMEWORKS_WM_INCLUDE_WINDOW_MANAGER_HILOG_H 50