1 unstable release

0.1.0 Oct 19, 2024

#553 in Debugging

MIT/Apache

12KB
216 lines

tracing-ohos

Composable tracing layer which logs to logcat using the OpenHarmony NDK's OH_LOG_Print function. The provided tag will be capped at 23 bytes. Logging events resulting in messages longer than 4000 bytes will result in multiple log lines in logcat. This avoids running into logcat's truncation behaviour.

This crate is mainly based on the tracing-android crate.

License: MIT OR Apache-2.0

Example

Constructs a Layer with the given tag.

 use tracing_subscriber::layer::SubscriberExt;
 use tracing_subscriber::util::SubscriberInitExt;

 let ohrs_writer_layer = tracing_ohos::layer(0x0000, "TAG")?;

 tracing_subscriber::registry()
    .with(ohrs_writer_layer)
    .with(filter)
    .init();

lib.rs:

tracing-ohos

Composable tracing layer which logs to logcat using the OpenHarmony NDK's OH_LOG_Print function. The provided tag will be capped at 23 bytes. Logging events resulting in messages longer than 4000 bytes will result in multiple log lines in logcat. This avoids running into logcat's truncation behaviour.

This crate is mainly based on the tracing-android crate.

License: MIT OR Apache-2.0

Example

Constructs a layer::Layer with the given tag.

 use tracing_subscriber::layer::SubscriberExt;
 use tracing_subscriber::util::SubscriberInitExt;

 let ohrs_writer_layer = tracing_ohos::layer(0x0000, "homogrape")?;

 tracing_subscriber::registry()
    .with(ohrs_writer_layer)
    .with(filter)
    .init();

Dependencies

~1.5MB
~22K SLoC