OpenHarmony开发者论坛
标题:
为什么日志没有输出
[打印本页]
作者:
webster
时间:
2024-4-28 03:44
标题:
为什么日志没有输出
[md]```
#ifndef OHOS_SERIALSERVICE_LOG_WRAPPER_H
#define OHOS_SERIALSERVICE_LOG_WRAPPER_H
#include "hilog/log.h"
#ifdef LOG_DOMAIN
#undef LOG_DOMAIN
#endif
#ifdef LOG_TAG
#undef LOG_TAG
#endif
namespace OHOS {
namespace Serial {
using namespace OHOS::HiviewDFX;
static constexpr unsigned int LOG_DOMAIN = 0xD006666;
static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN, "SerialService"};
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
//#define FORMAT(fmt, ...) "[%{public}s:%{public}d] %{public}s# " fmt, FILENAME, __LINE__, __FUNCTION__, ##__VA_ARGS__
//#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
/*
#ifndef __cplusplus
#define SERIALSERVICE_LOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGI(fmt, ...) HILOG_INFO(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGW(fmt, ...) HILOG_WARN(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGE(fmt, ...) HILOG_ERROR(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGF(fmt, ...) HILOG_FATAL(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
#else
*/
#define SERIALSERVICE_LOGE(fmt, ...) HiLog::Error( \
LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGW(fmt, ...) HiLog::Warn( \
LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGI(fmt, ...) HiLog::Info( \
LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGF(fmt, ...) HiLog::Fatal( \
LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define SERIALSERVICE_LOGD(fmt, ...) HiLog:
ebug( \
LABEL, "[%{public}s(%{public}s:%{public}d)]" fmt, __FILENAME__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
//#endif
}
}
#endif // OHOS_SERIALSERVICE_LOG_WRAPPER_H
```
[/md]
作者:
深开鸿_王石
时间:
2024-4-28 18:26
ndk里用hilog可以看:
https://forums.openharmony.cn/fo ... tid=1983&extra=
;若是设备上的应用,那就随便找个exe看看就好,比如hidumper啥的
欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/)
Powered by Discuz! X3.5