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
printfstyle format specifiers (like%s,%d) OR fmtis"${public}s\0"and the actual string is passed as the following parameter.
§Crate Features
log: When the log feature is enabled, aFrom<log::Level>implementation is added to easily convert fromlogs log level to HiLogs log level.
§Feature flags
§log crate interop
log— AddsFromandIntoconversion fromlogLogLevel 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 11api-12— Enables bindings for OpenHarmony API-level 12 (No changes)api-13— Enables bindings for OpenHarmony API-level 13 (No changes)api-14— Enables bindings for OpenHarmony API-level 14 (No changes)api-15— Enables bindings for OpenHarmony API-level 15 (No changes)api-16— Enables bindings for OpenHarmony API-level 16.api-17— Enables bindings for OpenHarmony API-level 17.api-18— Enables bindings for OpenHarmony API-level 18 (5.1.0).api-19— Enables bindings for OpenHarmony API-level 19.api-20— Enables bindings for OpenHarmony API-level 20.api-21— Enables bindings for OpenHarmony API-level 21.document-features— Document available features when building the documentation
Structs§
- LogLevel
- Enumerates log levels.
- LogType
- Enumerates log types.
- Prefer
Strategy api-21 - Enumerates preference strategy to be used in
OH_LOG_SetLogLevel.
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_ ⚠Print Msg api-18 - Outputs logs.
- OH_
LOG_ ⚠Print MsgBy Len api-18 - Outputs logs.
- OH_
LOG_ ⚠SetCallback api-11 - Set the user-defined log processing function.
- OH_
LOG_ ⚠SetLog Level api-21 - Sets the lowest log level of the current application process. Different preference strategy can be set.
- OH_
LOG_ ⚠SetMin LogLevel api-15 - Sets the lowest log level of the current application process.
Type Aliases§
- LogCallback
api-11 - Defines the function pointer type for the user-defined log processing function.