Crate hilog_sys

Source
Expand description

hilog-sys

Rust bindings for the HiLog logging framework of OpenHarmony. This crate should only be used on OpenHarmony (target_env = "ohos"). More information on hilog in native applications is available in the hilog native guidelines. You can use the hdc tools [hilog command-line interface] to query the saved logs.

§Safety

When using OH_LOG_Print from Rust you must ensure that the fmt parameter either

  • Does not contain any printf style format specifiers (like %s, %d) OR
  • fmt is "${public}s\0" and the actual string is passed as the following parameter.

§Crate Features

  • log: When the log feature is enabled, a From<log::Level> implementation is added to easily convert from logs log level to HiLogs log level.

§Feature flags

§log crate interop

  • log — Adds From and Into conversion from log LogLevel to Hilogs log level.

§OpenHarmony API level

This crate by default exposes bindings for API-level 10. Optionally enable one of the api-* features to get access to bindings for newer OpenHarmony versions.

  • api-10 (enabled by default) — No effect. API-10 bindings can’t be deselected. The feature exists for internal purposes.
  • api-11 — Enables bindings for OpenHarmony API-level 11
  • api-12 — Enables bindings for OpenHarmony API-level 12 (No changes)
  • api-13 — Enables bindings for OpenHarmony API-level 13 (No changes)
  • document-features — Document available features when building the documentation

Structs§

LogLevel
Enumerates log levels.
LogType
Enumerates log types.

Functions§

OH_LOG_IsLoggable
Checks whether logs of the specified service domain, log tag, and log level can be output.
OH_LOG_Print
Outputs logs.
OH_LOG_SetCallbackapi-11
Set the user-defined log processing function.

Type Aliases§

LogCallbackapi-11
Defines the function pointer type for the user-defined log processing function.