diff --git a/configure.py b/configure.py index cc33a3fa0405d93a6b1f99f7c8b685c0b308be98..b8ae1122b3ca59e166f526c7e9401bcb2d518ee5 100644 --- a/configure.py +++ b/configure.py @@ -1284,10 +1284,8 @@ def configure_node(o): o['variables']['host_arch'] = host_arch o['variables']['target_arch'] = target_arch o['variables']['node_byteorder'] = sys.byteorder - if options.target_platform in ('pc', 'emulator'): + if options.target_platform != 'phone': o['variables']['use_node_zlib'] = 'true' - - if options.target_platform == 'emulator': o['variables']['enable_hilog'] = 'false' cross_compiling = (options.cross_compiling diff --git a/jsvm/src/platform/platform_ohos.cc b/jsvm/src/platform/platform_ohos.cc index c7274a49741ed27ffbb65f2fca8401ea2cc4c49e..24a95b8a3aed038c9aa585cab59655a6c1ea5387 100644 --- a/jsvm/src/platform/platform_ohos.cc +++ b/jsvm/src/platform/platform_ohos.cc @@ -4,7 +4,9 @@ #include "v8.h" // OHOS API header +#ifdef ENABLE_HILOG #include "hilog/log.h" +#endif #include "hitrace_meter.h" #include "init_param.h" #include "unistd.h" @@ -71,6 +73,7 @@ uint64_t OS::GetTid() void OS::PrintString(LogLevel level, const char* string) { +#ifdef ENABLE_HILOG // convert platform defined LogLevel to hilog LogLevel static constexpr ::LogLevel convertArray[] = { ::LogLevel::LOG_DEBUG, ::LogLevel::LOG_INFO, ::LogLevel::LOG_WARN, ::LogLevel::LOG_ERROR, ::LogLevel::LOG_FATAL }; @@ -78,6 +81,9 @@ void OS::PrintString(LogLevel level, const char* string) // TODO: use LOG_APP or other LogType HiLogPrint(LOG_APP, convertArray[static_cast(level)], LOG_DOMAIN, LOG_TAG, "%{public}s", string); +#else + printf("%s", string); +#endif } void OS::Print(LogLevel level, const char* format, ...) diff --git a/node.gyp b/node.gyp index e187e66360cb209013d462e86ad1155a82ec0c40..40ea42c867b35089a84efc82964170e95a2742fe 100644 --- a/node.gyp +++ b/node.gyp @@ -481,6 +481,9 @@ [ 'enable_hilog=="true"' , { 'ldflags' : [ '<(NDK_SYS_ROOT)/hiviewdfx/hilog_override/libhilog.so', + ], + 'defines': [ + 'ENABLE_HILOG', ] } ], ],