• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd. 2021-2021.
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 #ifndef STORAGE_SERVICE_FILESYSTEM_LOG_H
16 #define STORAGE_SERVICE_FILESYSTEM_LOG_H
17 
18 #include "hilog/log.h"
19 namespace OHOS {
20 static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, 0, "fs_manager" };
21 
22 #define SSLOG_F(...) (void)OHOS::HiviewDFX::HiLog::Fatal(LOG_LABEL, __VA_ARGS__)
23 #define SSLOG_E(...) (void)OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, __VA_ARGS__)
24 #define SSLOG_W(...) (void)OHOS::HiviewDFX::HiLog::Warn(LOG_LABEL, __VA_ARGS__)
25 #define SSLOG_I(...) (void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, __VA_ARGS__)
26 #define SSLOG_D(...) (void)OHOS::HiviewDFX::HiLog::Debug(LOG_LABEL, __VA_ARGS__)
27 
28 #define _SS_DFUNCTION HiviewDFX::HiLog::Info
29 #define _SS_IFUNCTION HiviewDFX::HiLog::Info
30 #define _SS_WFUNCTION HiviewDFX::HiLog::Warn
31 #define _SS_EFUNCTION HiviewDFX::HiLog::Error
32 
33 #define _SS_LOGCPRINTF(func, fmt, ...) func(LABEL, "<%{public}d>" fmt, __LINE__, ##__VA_ARGS__)
34 
35 #define SSLOGD(fmt, ...) _SS_LOGCPRINTF(_SS_DFUNCTION, " DEBUG " fmt, ##__VA_ARGS__)
36 #define SSLOGI(fmt, ...) _SS_LOGCPRINTF(_SS_IFUNCTION, fmt, ##__VA_ARGS__)
37 #define SSLOGW(fmt, ...) _SS_LOGCPRINTF(_SS_WFUNCTION, fmt, ##__VA_ARGS__)
38 #define SSLOGE(fmt, ...) _SS_LOGCPRINTF(_SS_EFUNCTION, fmt, ##__VA_ARGS__)
39 
40 #define _SS_FUNCTION __func__
41 
42 #define SSLOGFD(fmt, ...) SSLOGD("%{public}s: " fmt, _SS_FUNCTION, ##__VA_ARGS__)
43 #define SSLOGFI(fmt, ...) SSLOGI("%{public}s: " fmt, _SS_FUNCTION, ##__VA_ARGS__)
44 #define SSLOGFW(fmt, ...) SSLOGW("%{public}s: " fmt, _SS_FUNCTION, ##__VA_ARGS__)
45 #define SSLOGFE(fmt, ...) SSLOGE("%{public}s: " fmt, _SS_FUNCTION, ##__VA_ARGS__)
46 } // namespace OHOS
47 
48 #endif // STORAGE_SERVICE_FILESYSTEM_LOG_H