#ohos #binding #hilog #napi #tags #debugging #hilog-binding

ohos-hilog-binding

hilog binding for rust

5 releases

new 0.1.0 Feb 10, 2025
0.0.4 Oct 22, 2024
0.0.3 Jun 4, 2024
0.0.2 Jun 4, 2024
0.0.1 Mar 19, 2024

#2 in #ohos

Download history 56/week @ 2024-10-23 3/week @ 2024-10-30 11/week @ 2024-11-06 3/week @ 2024-11-13 4/week @ 2024-11-20 6/week @ 2024-12-04 19/week @ 2024-12-11 1/week @ 2024-12-25 71/week @ 2025-02-05

71 downloads per month
Used in ohos-xcomponent-binding

MIT/Apache

13KB
302 lines

hilog_binding

Install

cargo add hilog_binding

Usage

use hilog_binding::hilog_debug;
use napi_derive_ohos::napi;

#[napi]
pub fn add(left: u32, right: u32) -> u32 {
    hilog_debug!("hello world");
    hilog_debug!(
        "test",
        LogOptions {
          tag: Some("testTag"),
          domain: None
      }
    );
    left + right
}

Feature

redirect

Allow us redirect stdout/stderr to hilog.

# Cargo.toml

[dependencies]
ohos-hilog-binding = {version = "*", features = ["redirect"]}
use napi_derive_ohos::napi;

#[napi]
pub fn add(left: u32, right: u32) -> u32 {
  // setup at first
  let _handle = ohos_hilog_binding::forward_stdio_to_hilog();
  // can be redirected to hilog with info level
  println!("hello");
  
  left + right
}


Dependencies

~14KB