未验证 提交 503dfc5a 编写于 作者: O openharmony_ci 提交者: Gitee

!417 musl支持Hilog输出

Merge pull request !417 from dhy308/branch_musl_hilog
......@@ -49,3 +49,7 @@ declare_args() {
# musl_linker_extension
# }
}
declare_args() {
enable_musl_log = false
}
......@@ -327,6 +327,8 @@ musl_src_file = [
"src/internal/syscall_ret.c",
"src/internal/vdso.c",
"src/internal/version.c",
"src/hilog/hilog_adapter.c",
"src/hilog/vsnprintf_s_p.c",
"src/ipc/ftok.c",
"src/ipc/msgctl.c",
"src/ipc/msgget.c",
......@@ -1876,6 +1878,9 @@ musl_src_porting_file = [
"include/unistd.h",
"include/dlfcn.h",
"include/dlfcn_ext.h",
"src/hilog/hilog_common.h",
"src/hilog/vsnprintf_s_p.h",
"src/internal/hilog_adapter.h",
"src/internal/musl_log.h",
"src/info/application_target_sdk_version.c",
"src/info/device_api_version.c",
......@@ -1931,6 +1936,8 @@ musl_src_porting_file = [
"src/signal/signal.c",
"include/langinfo.h",
"include/locale.h",
"src/hilog/hilog_adapter.c",
"src/hilog/vsnprintf_s_p.c",
"src/internal/libc.h",
"src/locale/dcngettext.c",
"src/locale/locale_map.c",
......
......@@ -185,6 +185,10 @@ template("musl_libs") {
defines += [ "OHOS_DNS_PROXY_BY_NETSYS=1" ]
}
if (enable_musl_log) {
defines += [ "ENABLE_MUSL_LOG" ]
}
dynamic_list =
rebase_path("${target_out_dir}/${musl_ported_dir}/dynamic.list")
......
......@@ -25,26 +25,28 @@
#define LD_LOG_LEVEL (LD_LOG_ERROR | LD_LOG_WARNING)
#define LD_LOG_TAG "MUSL-LDSO"
#if (LD_LOG_LEVEL & LD_LOG_ERROR)
#define LD_LOGE(...) MUSL_LOGE(...)
#define LD_LOGE(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_ERROR, MUSL_LOG_DOMAIN, LD_LOG_TAG, __VA_ARGS__))
#else
#define LD_LOGE(...)
#endif
#if (LD_LOG_LEVEL & LD_LOG_WARNING)
#define LD_LOGW(...) MUSL_LOGW(...)
#define LD_LOGW(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_WARN, MUSL_LOG_DOMAIN, LD_LOG_TAG, __VA_ARGS__))
#else
#define LD_LOGW(...)
#endif
#if (LD_LOG_LEVEL & LD_LOG_INFO)
#define LD_LOGI(...) MUSL_LOGI(...)
#define LD_LOGI(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_INFO, MUSL_LOG_DOMAIN, LD_LOG_TAG, __VA_ARGS__))
#else
#define LD_LOGI(...)
#endif
#if (LD_LOG_LEVEL & LD_LOG_DEBUG)
#define LD_LOGD(...) MUSL_LOGD(...)
#define LD_LOGD(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_DEBUG, MUSL_LOG_DOMAIN, LD_LOG_TAG, __VA_ARGS__))
#else
#define LD_LOGD(...)
#endif
......
/*
* 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.
*/
#define _GNU_SOURCE
#include <hilog_adapter.h>
#include "hilog_common.h"
#include "vsnprintf_s_p.h"
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <time.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <unistd.h>
#define LOG_LEN 3
#define ERROR_FD 2
const int SOCKET_TYPE = SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC;
const int INVALID_SOCKET = -1;
const struct sockaddr_un SOCKET_ADDR = {AF_UNIX, SOCKET_FILE_DIR INPUT_SOCKET_NAME};
static int SendMessage(HilogMsg *header, const char *tag, uint16_t tagLen, const char *fmt, uint16_t fmtLen)
{
int socketFd = TEMP_FAILURE_RETRY(socket(AF_UNIX, SOCKET_TYPE, 0));
if (socketFd < 0) {
dprintf(ERROR_FD, "%s %d Can't create socket! Errno: %d\n", __FILE__, __LINE__, errno);
return socketFd;
}
long int result =
TEMP_FAILURE_RETRY(connect(socketFd, (const struct sockaddr *)(&SOCKET_ADDR), sizeof(SOCKET_ADDR)));
if (result < 0) {
dprintf(ERROR_FD, "%s %d Can't connect to server. Errno: %d\n", __FILE__, __LINE__, errno);
if (socketFd >= 0) {
close(socketFd);
}
return result;
}
struct timespec ts = {0};
(void)clock_gettime(CLOCK_REALTIME, &ts);
struct timespec ts_mono = {0};
(void)clock_gettime(CLOCK_MONOTONIC, &ts_mono);
header->tv_sec = (uint32_t)(ts.tv_sec);
header->tv_nsec = (uint32_t)(ts.tv_nsec);
header->mono_sec = (uint32_t)(ts_mono.tv_sec);
header->len = sizeof(HilogMsg) + tagLen + fmtLen;
header->tag_len = tagLen;
struct iovec vec[LOG_LEN] = {0};
vec[0].iov_base = header; // 0 : index of hos log header
vec[0].iov_len = sizeof(HilogMsg); // 0 : index of hos log header
vec[1].iov_base = (void *)((char *)(tag)); // 1 : index of log tag
vec[1].iov_len = tagLen; // 1 : index of log tag
vec[2].iov_base = (void *)((char *)(fmt)); // 2 : index of log content
vec[2].iov_len = fmtLen; // 2 : index of log content
int ret = TEMP_FAILURE_RETRY(writev(socketFd, vec, LOG_LEN));
if (socketFd >= 0) {
close(socketFd);
}
return ret;
}
static int HiLogAdapterPrintArgs(
const LogType type, const LogLevel level, const unsigned int domain, const char *tag, const char *fmt, va_list ap)
{
if (!HiLogAdapterIsLoggable(domain, tag, level)) {
return -1;
}
char buf[MAX_LOG_LEN] = {0};
vsnprintfp_s(buf, MAX_LOG_LEN, MAX_LOG_LEN - 1, true, fmt, ap);
size_t tagLen = strnlen(tag, MAX_TAG_LEN - 1);
size_t logLen = strnlen(buf, MAX_LOG_LEN - 1);
HilogMsg header = {0};
header.type = type;
header.level = level;
#ifndef __RECV_MSG_WITH_UCRED_
header.pid = getpid();
#endif
header.tid = (uint32_t)(gettid());
header.domain = domain;
return SendMessage(&header, tag, tagLen + 1, buf, logLen + 1);
}
int HiLogAdapterPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
{
int ret;
va_list ap;
va_start(ap, fmt);
ret = HiLogAdapterPrintArgs(type, level, domain, tag, fmt, ap);
va_end(ap);
return ret;
}
bool HiLogAdapterIsLoggable(unsigned int domain, const char *tag, LogLevel level)
{
if ((level <= LOG_LEVEL_MIN) || (level >= LOG_LEVEL_MAX) || tag == NULL) {
return false;
}
return true;
}
/*
* 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.
*/
#ifndef HILOG_COMMON_H
#define HILOG_COMMON_H
#include <stdint.h>
#include <stddef.h>
#define SOCKET_FILE_DIR "/dev/unix/socket/"
#define INPUT_SOCKET_NAME "hilogInput"
#define MAX_LOG_LEN 1024 /* maximum length of a log, include '\0' */
#define MAX_TAG_LEN 32 /* log tag size, include '\0' */
/*
* header of log message from libhilog to hilogd
*/
typedef struct __attribute__((__packed__)) {
uint16_t len;
uint16_t version : 3;
uint16_t type : 4; /* APP,CORE,INIT,SEC etc */
uint16_t level : 3;
uint16_t tag_len : 6; /* include '\0' */
uint32_t tv_sec;
uint32_t tv_nsec;
uint32_t mono_sec;
uint32_t pid;
uint32_t tid;
uint32_t domain;
char tag[]; /* shall be end with '\0' */
} HilogMsg;
#if defined(__GNUC__) && (__GNUC__ >= 4)
#define HILOG_PUBLIC_API __attribute__((visibility("default")))
#define HILOG_LOCAL_API __attribute__((visibility("hidden")))
#else
#define HILOG_PUBLIC_API
#define HILOG_LOCAL_API
#endif
#endif /* HILOG_COMMON_H */
此差异已折叠。
/*
* 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 "vsnprintf_s_p.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
/* Define the max length of the string */
#ifndef SECUREC_STRING_MAX_LEN
#define SECUREC_STRING_MAX_LEN 0x7fffffffUL
#endif
#if SECUREC_STRING_MAX_LEN > 0x7fffffffUL
#error "max string is 2G"
#endif
#if defined(_DEBUG) || defined(DEBUG)
#if defined(SECUREC_ERROR_HANDLER_BY_ASSERT)
#define SECUREC_ERROR_INVALID_PARAMTER(msg) assert( msg "invalid argument" == NULL)
#define SECUREC_ERROR_INVALID_RANGE(msg) assert( msg "invalid dest buffer size" == NULL)
#elif defined(SECUREC_ERROR_HANDLER_BY_PRINTF)
#if SECUREC_IN_KERNEL
#define SECUREC_ERROR_INVALID_PARAMTER(msg) printk( "%s invalid argument\n",msg)
#define SECUREC_ERROR_INVALID_RANGE(msg) printk( "%s invalid dest buffer size\n", msg)
#else
#define SECUREC_ERROR_INVALID_PARAMTER(msg) printf( "%s invalid argument\n",msg)
#define SECUREC_ERROR_INVALID_RANGE(msg) printf( "%s invalid dest buffer size\n", msg)
#endif
#elif defined(SECUREC_ERROR_HANDLER_BY_FILE_LOG)
#define SECUREC_ERROR_INVALID_PARAMTER(msg) LogSecureCRuntimeError(msg " EINVAL\n")
#define SECUREC_ERROR_INVALID_RANGE(msg) LogSecureCRuntimeError(msg " ERANGE\n")
#else
#define SECUREC_ERROR_INVALID_PARAMTER(msg) ((void)0)
#define SECUREC_ERROR_INVALID_RANGE(msg) ((void)0)
#endif
#else
#define SECUREC_ERROR_INVALID_PARAMTER(msg) ((void)0)
#define SECUREC_ERROR_INVALID_RANGE(msg) ((void)0)
#define SECUREC_ERROR_BUFFER_OVERLAP(msg) ((void)0)
#endif
#define SECUREC_PRINTF_TRUNCATE (-2)
typedef struct {
int count;
char *cur;
} SecPrintfStream;
#ifdef SECUREC_STACK_SIZE_LESS_THAN_1K
/* SECUREC_BUFFER_SIZE Can not be less than 23 ,
*the length of the octal representation of 64-bit integers with zero lead
*/
#define SECUREC_BUFFER_SIZE 256
#else
#define SECUREC_BUFFER_SIZE 512
#endif
#define SECUREC_MAX_PRECISION SECUREC_BUFFER_SIZE
/* max. # bytes in multibyte char ,see MB_LEN_MAX */
#define SECUREC_MB_LEN 16
#if (defined(_MSC_VER)) && (_MSC_VER >= 1400)
#define SECUREC_MASK_MSVC_CRT_WARNING __pragma(warning(push)) \
__pragma(warning(disable:4996 4127))
#define SECUREC_END_MASK_MSVC_CRT_WARNING __pragma(warning(pop))
#else
#define SECUREC_MASK_MSVC_CRT_WARNING
#define SECUREC_END_MASK_MSVC_CRT_WARNING
#endif
#define SECUREC_WHILE_ZERO SECUREC_MASK_MSVC_CRT_WARNING while (0) SECUREC_END_MASK_MSVC_CRT_WARNING
/* flag definitions */
/* Using macros instead of enumerations is because some of the enumerated types under the compiler are 16bit. */
#define SECUREC_FLAG_SIGN 0x00001U
#define SECUREC_FLAG_SIGN_SPACE 0x00002U
#define SECUREC_FLAG_LEFT 0x00004U
#define SECUREC_FLAG_LEADZERO 0x00008U
#define SECUREC_FLAG_LONG 0x00010U
#define SECUREC_FLAG_SHORT 0x00020U
#define SECUREC_FLAG_SIGNED 0x00040U
#define SECUREC_FLAG_ALTERNATE 0x00080U
#define SECUREC_FLAG_NEGATIVE 0x00100U
#define SECUREC_FLAG_FORCE_OCTAL 0x00200U
#define SECUREC_FLAG_LONG_DOUBLE 0x00400U
#define SECUREC_FLAG_WIDECHAR 0x00800U
#define SECUREC_FLAG_LONGLONG 0x01000U
#define SECUREC_FLAG_CHAR 0x02000U
#define SECUREC_FLAG_POINTER 0x04000U
#define SECUREC_FLAG_I64 0x08000U
#define SECUREC_FLAG_PTRDIFF 0x10000U
#define SECUREC_FLAG_SIZE 0x20000U
#ifdef SECUREC_COMPATIBLE_LINUX_FORMAT
#define SECUREC_FLAG_INTMAX 0x40000U
#endif
/* put a char to output */
#define SECUREC_PUTC(_c,_stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)(_c)) & 0xff) : EOF)
/* to clear e835 */
#define SECUREC_PUTC_ZERO(_stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)('\0'))) : EOF)
/* state definitions */
typedef enum {
STAT_NORMAL,
STAT_PERCENT,
STAT_FLAG,
STAT_WIDTH,
STAT_DOT,
STAT_PRECIS,
STAT_SIZE,
STAT_TYPE,
STAT_INVALID
} SecFmtState;
#ifndef HILOG_PROHIBIT_ALLOCATION
#ifndef SECUREC_MALLOC
#define SECUREC_MALLOC(x) malloc((size_t)(x))
#endif
#ifndef SECUREC_FREE
#define SECUREC_FREE(x) free((void *)(x))
#endif
#else
#define SECUREC_MALLOC(x) (nullptr)
#define SECUREC_FREE(x) { printf("Malloc is not allowed, so free should not be possible to execute!"); std::abort(); }
#endif
#if (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER)) || defined(__ARMCC_VERSION)
typedef __int64 SecInt64;
typedef unsigned __int64 SecUnsignedInt64;
#if defined(__ARMCC_VERSION)
typedef int SecInt32;
typedef unsigned int SecUnsignedInt32;
#else
typedef __int32 SecInt32;
typedef unsigned __int32 SecUnsignedInt32;
#endif
#else
typedef int SecInt32;
typedef unsigned int SecUnsignedInt32;
typedef long long SecInt64;
typedef unsigned long long SecUnsignedInt64;
#endif
static inline void SecWriteString(const char *string, int len, SecPrintfStream *f, int *pnumwritten)
{
const char *str = string;
int count = len;
while (count-- > 0) {
if (SECUREC_PUTC(*str, f) == EOF) {
*pnumwritten = -1;
break;
} else {
++(*pnumwritten);
++str;
}
}
}
static inline void SecWriteMultiChar(char ch, int num, SecPrintfStream *f, int *pnumwritten)
{
int count = num;
while (count-- > 0) {
if (SECUREC_PUTC(ch, f) == EOF) {
*pnumwritten = -1;
break;
} else {
++(*pnumwritten);
}
}
}
static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const char *format, va_list arglist);
/*******************************************************************************
* <FUNCTION DESCRIPTION>
* The vsnprintf_s function is equivalent to the vsnprintf function
* except for the parameter destMax/count and the explicit runtime-constraints violation
* The vsnprintf_s function takes a pointer to an argument list, then formats
* and writes up to count characters of the given data to the memory pointed
* to by strDest and appends a terminating null.
*
* <INPUT PARAMETERS>
* strDest Storage location for the output.
* destMax The size of the strDest for output.
* count Maximum number of character to write(not including
* the terminating NULL)
* priv_on whether print <private> for not-public args
* format Format-control string.
* arglist pointer to list of arguments.
*
* <OUTPUT PARAMETERS>
* strDest is updated
*
* <RETURN VALUE>
* return the number of characters written, not including the terminating null
* return -1 if an error occurs.
* return -1 if count < destMax and the output string has been truncated
*
* If there is a runtime-constraint violation, strDest[0] will be set to the '\0' when strDest and destMax valid
*******************************************************************************
*/
HILOG_LOCAL_API
int vsnprintfp_s(char *strDest, size_t destMax, size_t count, int priv, const char *format, va_list arglist)
{
int retVal;
if (format == NULL || strDest == NULL || destMax == 0 || destMax > SECUREC_STRING_MAX_LEN ||
(count > (SECUREC_STRING_MAX_LEN - 1) && count != (size_t)-1)) {
if (strDest != NULL && destMax > 0) {
strDest[0] = '\0';
}
SECUREC_ERROR_INVALID_PARAMTER("vsnprintfp_s");
return -1;
}
if (destMax > count) {
retVal = SecVsnprintfPImpl(strDest, count + 1, priv, format, arglist);
if (retVal == SECUREC_PRINTF_TRUNCATE) { /* lsd add to keep dest buffer not destroyed 2014.2.18 */
/* the string has been truncated, return -1 */
return -1; /* to skip error handler, return strlen(strDest) or -1 */
}
} else { /* destMax <= count */
retVal = SecVsnprintfPImpl(strDest, destMax, priv, format, arglist);
#ifdef SECUREC_COMPATIBLE_WIN_FORMAT
if (retVal == SECUREC_PRINTF_TRUNCATE && count == (size_t)-1) {
return -1;
}
#endif
}
if (retVal < 0) {
strDest[0] = '\0'; /* empty the dest strDest */
if (retVal == SECUREC_PRINTF_TRUNCATE) {
/* Buffer too small */
SECUREC_ERROR_INVALID_RANGE("vsnprintfp_s");
}
SECUREC_ERROR_INVALID_PARAMTER("vsnprintfp_s");
return -1;
}
return retVal;
}
#ifdef SECUREC_FOR_WCHAR
#undef SECUREC_FOR_WCHAR
#endif
typedef char SecChar;
#define SECUREC_CHAR(x) x
#define SECUREC_WRITE_MULTI_CHAR SecWriteMultiChar
#define SECUREC_WRITE_STRING SecWriteString
#include "output_p.inl"
static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const char *format, va_list arglist)
{
SecPrintfStream str;
int retVal;
str.count = (int)count; /* this count include \0 character */
str.cur = string;
retVal = SecOutputPS(&str, priv, format, arglist);
if ((retVal >= 0) && (SECUREC_PUTC_ZERO(&str) != EOF)) {
return (retVal);
} else if (str.count < 0) {
/* the buffer was too small; we return truncation */
string[count - 1] = 0;
return SECUREC_PRINTF_TRUNCATE;
}
return -1;
}
/*
* 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.
*/
#ifndef __VSNPRINTFP_S_H__
#define __VSNPRINTFP_S_H__
#include "hilog_common.h"
#include <stddef.h>
#include <stdarg.h>
/**
* @Description: The vsnprintfp_s function is equivalent to the vsnprintf function except for the parameter destMax/count
* and the explicit runtime-constraints violation
* @param strDest - produce output according to a format ,write to the character string strDest
* @param destMax - The maximum length of destination buffer(including the terminating null byte ('\0'))
* @param count - do not write more than count bytes to strDest(not including the terminating null byte ('\0'))
* @param priv_on - if true, any not %{public} prefix formatter arguments will be printed as "<private>"
* @param format - format string
* @param arglist - instead of a variable number of arguments
* @return:return the number of characters printed(not including the terminating null byte ('\0')),
* If an error occurred return -1.Pay special attention to returning -1 when truncation occurs
*/
HILOG_LOCAL_API
int vsnprintfp_s(char *strDest, size_t destMax, size_t count, int priv, const char *format, va_list arglist);
#endif /* __VSNPRINTFP_S_H__ */
/*
* 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.
*/
#ifndef MUSL_HILOG_ADAPTER_H
#define MUSL_HILOG_ADAPTER_H
#include <stdarg.h>
#include <stdbool.h>
// Log type
typedef enum {
LOG_TYPE_MIN = 0,
LOG_APP = 0,
// Log to kmsg, only used by init phase.
LOG_INIT = 1,
// Used by core service, framework.
LOG_CORE = 3,
LOG_KMSG = 4,
LOG_TYPE_MAX
} LogType;
// Log level
typedef enum {
LOG_LEVEL_MIN = 0,
LOG_DEBUG = 3,
LOG_INFO = 4,
LOG_WARN = 5,
LOG_ERROR = 6,
LOG_FATAL = 7,
LOG_LEVEL_MAX,
} LogLevel;
int HiLogAdapterPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...)
__attribute__((__format__(os_log, 5, 6)));
bool HiLogAdapterIsLoggable(unsigned int domain, const char *tag, LogLevel level);
#endif // MUSL_HILOG_ADAPTER_H
......@@ -16,19 +16,21 @@
#ifndef _MUSL_LOG_H
#define _MUSL_LOG_H
#include <hilog_adapter.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MUSL_LOG_TYPE LOG_CORE
#define MUSL_LOG_DOMAIN 0xD003F00
#define MUSL_LOG_TAG "musl_linker"
#define MUSL_LOG_TAG "MUSL"
#ifdef ENABLE_MUSL_LOG
#define MUSL_LOGE(...) ((void)HiLogBasePrint(MUSL_LOG_TYPE, LOG_ERROR, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#define MUSL_LOGW(...) ((void)HiLogBasePrint(MUSL_LOG_TYPE, LOG_WARN, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#define MUSL_LOGI(...) ((void)HiLogBasePrint(MUSL_LOG_TYPE, LOG_INFO, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#define MUSL_LOGD(...) ((void)HiLogBasePrint(MUSL_LOG_TYPE, LOG_DEBUG, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#define MUSL_LOGE(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_ERROR, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#define MUSL_LOGW(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_WARN, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#define MUSL_LOGI(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_INFO, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#define MUSL_LOGD(...) ((void)HiLogAdapterPrint(MUSL_LOG_TYPE, LOG_DEBUG, MUSL_LOG_DOMAIN, MUSL_LOG_TAG, __VA_ARGS__))
#else
#define MUSL_LOGE(...)
#define MUSL_LOGW(...)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册