diff --git a/libpurgeablemem/cpp/include/pm_log.h b/libpurgeablemem/cpp/include/pm_log.h new file mode 100644 index 0000000000000000000000000000000000000000..9816942c25831eb444aec73b4e0fab6f7bdf3046 --- /dev/null +++ b/libpurgeablemem/cpp/include/pm_log.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "hilog/log.h" + +static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, 0xD001799, "MemMgrPurge" }; + +#ifdef HILOG_ERROR +#undef HILOG_ERROR +#endif + +#ifdef HILOG_INFO +#undef HILOG_INFO +#endif + +#ifdef HILOG_DEBUG +#undef HILOG_DEBUG +#endif + +#define FILENAME "purgeable" + +#define HILOG_ERROR(logCore, fmt, ...) \ + (void)OHOS::HiviewDFX::HiLog::Error( \ + LOG_LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, FILENAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) + +#define HILOG_INFO(logCore, fmt, ...) \ + (void)OHOS::HiviewDFX::HiLog::Info( \ + LOG_LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, FILENAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) + +#define HILOG_DEBUG(logCore, fmt, ...) \ + (void)OHOS::HiviewDFX::HiLog::Debug( \ + LOG_LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, FILENAME, __FUNCTION__, __LINE__, ##__VA_ARGS__) \ No newline at end of file diff --git a/libpurgeablemem/cpp/include/purgeable_mem.h b/libpurgeablemem/cpp/include/purgeable_mem.h index 9f2d461de321cac4f384ca6e52c56982e7a34e2c..57aa78f41877292854f4fb26e242c99cff4282b4 100644 --- a/libpurgeablemem/cpp/include/purgeable_mem.h +++ b/libpurgeablemem/cpp/include/purgeable_mem.h @@ -22,6 +22,7 @@ #include "purgeable_mem_builder.h" #include "ux_page_table.h" +#include "pm_log.h" namespace OHOS { namespace PurgeableMem {