• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 HYPERAIO_LIBHILOG_H
17 #define HYPERAIO_LIBHILOG_H
18 
19 #include "hilog/log.h"
20 
21 #include <string>
22 
23 namespace OHOS {
24 namespace HyperAio {
25 
26 #if defined __FILE_NAME__
27 #define FILEMGMT_FILE_NAME __FILE_NAME__
28 #else
29 #define FILEMGMT_FILE_NAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
30 #endif
31 
32 #ifndef HYPERAIO_LOG_DOMAIN
33 #define HYPERAIO_LOG_DOMAIN 0xD004388
34 #endif
35 
36 #undef HYPERAIO_LOG_TAG
37 #define HYPERAIO_LOG_TAG "hyperaio"
38 
39 #ifdef HILOGD
40 #undef HILOGD
41 #endif
42 
43 #ifdef HILOGF
44 #undef HILOGF
45 #endif
46 
47 #ifdef HILOGE
48 #undef HILOGE
49 #endif
50 
51 #ifdef HILOGW
52 #undef HILOGW
53 #endif
54 
55 #ifdef HILOGI
56 #undef HILOGI
57 #endif
58 
59 #define HILOGF(fmt, ...)            \
60     ((void)HILOG_IMPL(LOG_CORE, LOG_FATAL, HYPERAIO_LOG_DOMAIN, HYPERAIO_LOG_TAG, \
61     "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__))
62 #define HILOGE(fmt, ...)            \
63     ((void)HILOG_IMPL(LOG_CORE, LOG_ERROR, HYPERAIO_LOG_DOMAIN, HYPERAIO_LOG_TAG, \
64     "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__))
65 #define HILOGW(fmt, ...)            \
66     ((void)HILOG_IMPL(LOG_CORE, LOG_WARN, HYPERAIO_LOG_DOMAIN, HYPERAIO_LOG_TAG, \
67     "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__))
68 #define HILOGI(fmt, ...)            \
69     ((void)HILOG_IMPL(LOG_CORE, LOG_INFO, HYPERAIO_LOG_DOMAIN, HYPERAIO_LOG_TAG, \
70     "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__))
71 #define HILOGD(fmt, ...)            \
72     ((void)HILOG_IMPL(LOG_CORE, LOG_DEBUG, HYPERAIO_LOG_DOMAIN, HYPERAIO_LOG_TAG, \
73     "[%{public}s:%{public}d->%{public}s] " fmt, FILEMGMT_FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__))
74 } // namespace HyperAio
75 } // namespace OHOS
76 
77 #endif // HYPERAIO_LIBHILOG_H