diff --git a/interfaces/ets/ani/hilog/ets/@ohos.hilog.ets b/interfaces/ets/ani/hilog/ets/@ohos.hilog.ets index 15cb6a7ff9f8a9b383a5932a9845eb029d495f6e..affe2821d8ec0b0a2e20a08d27c77743d82d11cd 100644 --- a/interfaces/ets/ani/hilog/ets/@ohos.hilog.ets +++ b/interfaces/ets/ani/hilog/ets/@ohos.hilog.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -type RecordData = undefined | null | Object | Record | Array; +import { RecordData } from '@ohos.base'; export default namespace hilog { loadLibrary("hilog_ani"); diff --git a/interfaces/ets/ani/hilog/include/hilog_ani_base.h b/interfaces/ets/ani/hilog/include/hilog_ani_base.h index 6a9795dc77afa59e9ddc52c65082f28963ff2313..be04a7c7a92b02538cd02b86db06d86574fdda86 100644 --- a/interfaces/ets/ani/hilog/include/hilog_ani_base.h +++ b/interfaces/ets/ani/hilog/include/hilog_ani_base.h @@ -26,10 +26,10 @@ using AniParam = struct { std::string val; }; -typedef struct LogContentPosition { +struct LogContentPosition { uint32_t pos = 0; uint32_t count = 0; -} LogContentPosition; +}; class HilogAniBase { public: diff --git a/interfaces/ets/ani/hilog/src/ani_util.cpp b/interfaces/ets/ani/hilog/src/ani_util.cpp index 138833635dd2d09bb77887a0e55aa1593705c77a..c16401cf2ac31a62abd773f591b494952d650096 100644 --- a/interfaces/ets/ani/hilog/src/ani_util.cpp +++ b/interfaces/ets/ani/hilog/src/ani_util.cpp @@ -54,9 +54,9 @@ bool AniUtil::IsRefUndefined(ani_env *env, ani_ref ref) bool AniUtil::IsRefNull(ani_env *env, ani_ref ref) { - ani_boolean isUull = ANI_FALSE; - env->Reference_IsNull(ref, &isUull); - return isUull; + ani_boolean isNull = ANI_FALSE; + env->Reference_IsNull(ref, &isNull); + return isNull; } AniArgsType AniUtil::AniArgGetType(ani_env *env, ani_object element) @@ -104,7 +104,6 @@ std::string AniUtil::AniStringToStdString(ani_env *env, ani_string aniStr) char* utf8Buffer = buffer.data(); ani_size bytesWritten = 0; env->String_GetUTF8(aniStr, utf8Buffer, strSize + 1, &bytesWritten); - utf8Buffer[bytesWritten] = '\0'; return std::string(utf8Buffer); } diff --git a/interfaces/js/kits/napi/src/hilog/include/context/hilog_napi_base.h b/interfaces/js/kits/napi/src/hilog/include/context/hilog_napi_base.h index 5e59f3c00e4db1811f7bf2dc79bfca46b8146d51..e6b3a9c783ce481bcb7533e3d7940c65cfacce55 100644 --- a/interfaces/js/kits/napi/src/hilog/include/context/hilog_napi_base.h +++ b/interfaces/js/kits/napi/src/hilog/include/context/hilog_napi_base.h @@ -44,7 +44,7 @@ public: static napi_value IsLoggable(napi_env env, napi_callback_info info); static napi_value SetMinLogLevel(napi_env env, napi_callback_info info); private: - static napi_value parseNapiValue(napi_env env, napi_callback_info info, + static napi_value ParseNapiValue(napi_env env, napi_callback_info info, napi_value element, std::vector& params); }; } // namespace HiviewDFX diff --git a/interfaces/js/kits/napi/src/hilog/src/hilog_napi_base.cpp b/interfaces/js/kits/napi/src/hilog/src/hilog_napi_base.cpp index 7bbfab2c41a1f0b6fa1ad87ec00ffb44798e0475..f8e9e0103188ab85d758fd6a70f895b8d0569361 100644 --- a/interfaces/js/kits/napi/src/hilog/src/hilog_napi_base.cpp +++ b/interfaces/js/kits/napi/src/hilog/src/hilog_napi_base.cpp @@ -210,7 +210,7 @@ napi_value HilogNapiBase::SysLogFatal(napi_env env, napi_callback_info info) return HilogImpl(env, info, LOG_FATAL, false); } -napi_value HilogNapiBase::parseNapiValue(napi_env env, napi_callback_info info, +napi_value HilogNapiBase::ParseNapiValue(napi_env env, napi_callback_info info, napi_value element, vector& params) { bool succ = false; @@ -282,7 +282,7 @@ napi_value HilogNapiBase::HilogImpl(napi_env env, napi_callback_info info, int l if (!res) { for (size_t i = MIN_NUMBER; i < funcArg.GetArgc(); i++) { napi_value argsVal = funcArg[i]; - (void)parseNapiValue(env, info, argsVal, params); + (void)ParseNapiValue(env, info, argsVal, params); } } else { if (funcArg.GetArgc() != MIN_NUMBER + 1) { @@ -302,7 +302,7 @@ napi_value HilogNapiBase::HilogImpl(napi_env env, napi_callback_info info, int l if (eleStatus != napi_ok) { return nullptr; } - (void)parseNapiValue(env, info, element, params); + (void)ParseNapiValue(env, info, element, params); } } ParseLogContent(fmtString, params, logContent); diff --git a/interfaces/native/kits/include/hilog/log.h b/interfaces/native/kits/include/hilog/log.h index 57719641fa5188233f23ac9ebb88eb7ca27e8f2b..fe48b03a4600bb07ca2b11fb51749649bef1c2f1 100644 --- a/interfaces/native/kits/include/hilog/log.h +++ b/interfaces/native/kits/include/hilog/log.h @@ -165,7 +165,7 @@ int OH_LOG_Print(LogType type, LogLevel level, unsigned int domain, const char * * @param message Indicates the log string. * @return Returns 0 or a larger value if the operation is successful; returns a value smaller * than 0 otherwise. - * @since 16 + * @since 18 */ int OH_LOG_PrintMsg(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *message); @@ -185,7 +185,7 @@ int OH_LOG_PrintMsg(LogType type, LogLevel level, unsigned int domain, const cha * @param messageLen Indicates the length of message. * @return Returns 0 or a larger value if the operation is successful; returns a value smaller * than 0 otherwise. - * @since 16 + * @since 18 */ int OH_LOG_PrintMsgByLen(LogType type, LogLevel level, unsigned int domain, const char *tag, size_t tagLen, const char *message, size_t messageLen); @@ -209,7 +209,7 @@ int OH_LOG_PrintMsgByLen(LogType type, LogLevel level, unsigned int domain, cons * in the format string. * @return Returns 0 or a larger value if the operation is successful; returns a value smaller * than 0 otherwise. - * @since 16 + * @since 18 */ int OH_LOG_VPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, va_list ap) __attribute__((__format__(os_log, 5, 0)));